{
  "openapi": "3.1.0",
  "info": {
    "title": "Decionis Policy Evaluation API",
    "version": "0.6.0",
    "description": "Decionis evaluates captured execution intent against versioned policies\nbefore the caller performs the action. SDKs delegate policy judgment to this\nservice and locally enforce the signed decision. New SDK API keys can be\nassociated with an industry so Decionis provisions a starter encoded policy\nbinding server-side; applications do not receive or implement policy logic.\n\nv0.2 adds: escalation-ready proof-packet export for dossiers and decision\nchains; the ops spend-control gates (spend admission + disbursement authority\nwith duplicate-payment detection); native-surface decision federation; and the\nanonymous eBay Marketplace Account Deletion compliance endpoint required for an\neBay production keyset.\n\nv0.3 adds the policy-as-code draft endpoints: turn unstructured policy\nsources (PDF, JSON, XML, transaction and audit logs, uploads) and live\npolicy-source connectors (Jira, Confluence, Notion, Google Drive, Git\nrepositories, SAP) into a reviewable strategy draft or an executable,\ncompiler-validated policy pack.\n\nv0.4 adds the zero-human agent lane: anonymous provisional workspace\nminting with a signed issuer watermark, the public dossier verification\ntrio (verify, proof-bundle, reproduce) behind expiring share-link\ncapabilities, workspace claiming by email OTP, and org-wide share-link\nrevocation.\n\nv0.5 documents the UCP checkout authority and merchant verification-key\nsurfaces, exact UCP release negotiation, and additive Protocol 1.1 effect\nevidence without changing legacy finalization records.\n\nv0.6 makes the execution grant a REST resource: `/v1/authority/grants`\nissues it, and its `claims`, `receipts` and `reconciliations` claim it,\nfinalize it and resolve an INDETERMINATE attempt. `enforce-and-bind`,\n`verify-token`, `claim-token`, `consume-token` and `finalize-token` stay\nas deprecated aliases of the same handlers. It adds managed escalations,\npresence providers and provider keys, held allowances, governed plans,\npolicy records and proposals with workspace invariants, edge policy\nbundles, the execution-grant and policy-bundle key sets, outcome\nagreements, statements, charges and disputes, hosted-gateway\nauthorizations, keys and TCP resources, and the commerce payment and\nBusiness Central surfaces.\n"
  },
  "servers": [
    {
      "url": "https://api.decionis.com"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v1/analytics/growth-reports/consent/{orgId}": {
      "put": {
        "operationId": "recordGrowthReportConsent",
        "summary": "Record or revoke aggregate-publication consent (platform operator only)",
        "description": "Record actual customer permission and an internal evidence reference. Consent is separate from analytics classification and is never inferred from product usage. Revocation affects future reports; previously frozen artifacts require editorial review.",
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "opted_in",
                  "consent_reference"
                ],
                "properties": {
                  "opted_in": {
                    "type": "boolean"
                  },
                  "consent_reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Consent recorded"
          },
          "403": {
            "description": "Platform operator authentication required"
          },
          "404": {
            "description": "Organization not found"
          }
        }
      }
    },
    "/v1/analytics/growth-reports/blast-radius/{month}": {
      "post": {
        "operationId": "prepareBlastRadiusReport",
        "summary": "Prepare or retrieve an immutable signed monthly aggregate (platform operator only)",
        "description": "Completed UTC calendar month only. Includes consented external production organizations, with at least five distinct organizations per published mode/outcome cell. Smaller cells and all cross-cell totals are suppressed. Empty eligible cohorts are not published. Existing months return the original artifact. This prepares evidence and does not publish or email it.",
        "parameters": [
          {
            "name": "month",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^20[0-9]{2}-(0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Previously frozen signed artifact"
          },
          "201": {
            "description": "Signed artifact prepared for editorial review"
          },
          "400": {
            "description": "Month has not completed"
          },
          "403": {
            "description": "Platform operator authentication required"
          },
          "409": {
            "description": "Insufficient consented cohort or concurrent freeze; no replacement"
          },
          "503": {
            "description": "Dedicated reporting key not configured"
          }
        }
      }
    },
    "/v1/analytics/growth-scorecard": {
      "get": {
        "operationId": "getGrowthScorecard",
        "summary": "Read the external production growth scorecard (platform operator only)",
        "description": "Counts durable decisions for reviewed external production organizations. Unclassified organizations are excluded and reported separately; empty cohorts have null rates. Requires the platform API key, not an organization key.",
        "responses": {
          "200": {
            "description": "UTC cohort counts, measured durations, and nullable rates"
          },
          "403": {
            "description": "Platform operator authentication required"
          }
        }
      }
    },
    "/v1/analytics/growth-scorecard/orgs/{orgId}": {
      "put": {
        "operationId": "classifyGrowthOrganization",
        "summary": "Classify organization traffic for growth measurement (platform operator only)",
        "description": "First classification freezes surface and source_utm. Subsequent calls update environment and audience only. This is an analytics classification, not execution policy.",
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "environment",
                  "audience",
                  "surface"
                ],
                "properties": {
                  "environment": {
                    "type": "string",
                    "enum": [
                      "prod",
                      "staging",
                      "dev"
                    ]
                  },
                  "audience": {
                    "type": "string",
                    "enum": [
                      "external",
                      "internal",
                      "sandbox",
                      "demo"
                    ]
                  },
                  "surface": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,79}$"
                  },
                  "source_utm": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "medium": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "campaign": {
                        "type": "string",
                        "maxLength": 120
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current classification and immutable first-touch attribution"
          },
          "403": {
            "description": "Platform operator authentication required"
          },
          "404": {
            "description": "Organization not found"
          }
        }
      }
    },
    "/v1/analytics/growth-scorecard/baselines/{name}": {
      "post": {
        "operationId": "freezeGrowthBaseline",
        "summary": "Freeze a growth scorecard snapshot once (platform operator only)",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]{1,80}$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Immutable measured baseline captured"
          },
          "403": {
            "description": "Platform operator authentication required"
          },
          "409": {
            "description": "Baseline name already frozen; no replacement performed"
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Validate API connectivity",
        "responses": {
          "200": {
            "description": "API is reachable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/protocol/evaluate-decision": {
      "post": {
        "operationId": "evaluateDecision",
        "summary": "Evaluate captured execution intent without executing it",
        "description": "Canonical SDK/API route for Decionis execution-gate decisions.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CorrelationId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProtocolEvaluateDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Policy decision",
            "headers": {
              "x-decionis-warning": {
                "$ref": "#/components/headers/DecionisWarning"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolEvaluateDecisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/evaluation-receipts": {
      "get": {
        "operationId": "getProtocolEvaluationReceipt",
        "summary": "Recover a recorded evaluation receipt after an ambiguous response",
        "description": "Read-only recovery for an authenticated protocol service identity and its\nauthorized organization. Ordinary organization and platform API keys are\nrejected. Requires the service bearer token and X-Org-ID header. Does not\nevaluate an action or return request, customer, or decision payloads.\nThe mode is the original persisted effective response mode, corroborated\nby the evaluation row. Missing, unknown, or conflicting mode evidence\nreturns null; it is never inferred from requested mode or current workspace\nsettings. Consumers must not treat null, SHADOW, or PARALLEL as paid\nenforcement. A not_found receipt is not evidence of a completed evaluation.\n",
        "security": [
          {
            "ProtocolServiceAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-Org-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "idempotency_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "description": "Optional assertion; must match the authenticated organization.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Opaque receipt and nullable recorded effective mode; private and not cacheable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolEvaluationReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Receipt store unavailable; no inference about completion or mode is safe"
          }
        }
      }
    },
    "/v1/authority/enforce-and-bind": {
      "post": {
        "operationId": "enforceAndBindAgentAction",
        "deprecated": true,
        "summary": "Evaluate and bind one exact agent action to a single-use execution grant",
        "description": "Deprecated alias of `POST /v1/authority/grants`: the same handler,\nkept registered so AgentSafe 0.3.8, the Go govern client and installed\nSDKs keep working byte-for-byte. Removal is a later, separate decision.\n\nAgent-Safe enforcement route. Decionis recomputes the SHA-256\nhash of the canonical execution intent, evaluates policy in ENFORCEMENT\nmode, and issues a short-lived Ed25519 execution grant only for an ALLOW\nevaluated in ENFORCEMENT mode. SHADOW records the same exact intent and\ndossier evidence without issuing an execution grant.\nWhen Idempotency-Key is supplied, it must exactly match the intent_id\nembedded in the signed intent; intent_id is the grant issuance boundary.\nThe intent's own `context.idempotency_key` is hashed into the intent\nand is not this header: any other header value answers 400\nAUTHORITY_IDEMPOTENCY_KEY_MISMATCH, with a `message` saying so.\nESCALATE, REVIEW_REQUIRED, BLOCK, dependency errors, and binding errors\nnever receive a grant. A Presence approval is accepted only after\nDecionis verifies the action-bound request and sealed receipt directly\nwith Presence; approval then becomes evidence for a fresh policy\nevaluation, not authority by itself.\nA presence attestation (`evidence.humanApproval.provider`\n`attestation`) is a presence provider's compact JWS, typ\n`decionis-presence-attestation+jwt`, verified against a key the\norganisation registered at `/v1/execution/provider-keys` with purpose\n`presence_attestation` (see PresenceAttestationClaims). On success its\nfacts are written to `agent_safe.human_approval` (provider, verified,\nmethod, approver_role, subject, attestation_id, key_id,\napproved_action_digest, approved_at, expires_at, and token_match /\nnetwork_validated when the provider sent them) for policy rules to\nmatch, and the resulting ExecutionBinding records the attested\napproval. An ESCALATE becomes an ALLOW only when the organisation's\npolicy has a rule matching those facts. A refused attestation is a 409\nwith one of the PresenceAttestationRefusal codes, and no evaluation\nruns.\nA signed producer signal (`evidence.signals[].token`) is a producer's\ncompact JWS, typ `decionis-signed-signal+jwt`, standing for up to\nthirty days and bound to no intent: a cardholder's delegation to an\nagent, say (see SignedSignalClaims). Each is verified before any\nevaluation against a key the organisation registered at\n`/v1/execution/provider-keys` with purpose `signed_signal`, or\nagainst the JWKS of an admitted presence provider, and its facts are\nwritten to `agent_safe.signed_signals.<name>` (verified, producer,\nmethod, subject, signal_id, key_id, issued_at, expires_at,\nevidence_digest, what it asserted, and `covers` / `covers_intent`:\nwhat of this intent it covers). A policy names the fact with\n`required_signals` as a dotted path\n(`agent_safe.signed_signals.card_delegation`) and decides with rules;\nthe ExecutionBinding records the facts, and the claim rebuilds them\nand re-checks the key and the expiry. Signals may come with or\nwithout a human approval, in any mode, and beside a managed\nescalation. A refused signal is a 409 with one of the\nSignedSignalRefusal codes; no evaluation runs and no event fires.\nThe token itself is never recorded, only its SHA-256 as\n`evidence_digest`.\nA runtime that read the target before asking states what it read in\n`context.agent_safe.precondition` (ExecutionTargetPrecondition:\n`version`, optional `state`, `source`, `read_at`), inside the intent\nhash. Policy reads it as `agent_safe.precondition`, and a bundle's\n`allowed_transitions` read its `state`; the grant binds `version` as\n`binding.expected_state_version`, and the claim's attestation carries\nit to a verifying provider, which refuses the write\n(`TARGET_STATE_CHANGED`) once the target has moved on. A malformed\nprecondition is a 400 `INTENT_PRECONDITION_INVALID`, and nothing is\nevaluated.\nAn ESCALATE in ENFORCEMENT, direct or managed, is queued to the\norganisation's event subscribers as `authority.escalation_required`,\ncarrying the policy's selector and who proves the person (the\n`verification` block: `provider`, `methods`, `level`); and once the\nintent is presented again with human approval evidence, the answer\nis queued as `authority.escalation_resolved` (the fresh decision's\noutcome, or REFUSED with the refusal code), with the proof's facts\nand never the proof. Delivery never affects a decision. The same\nrouting rides on an ESCALATE decision as `escalation_requirement`\nfor the runtime from agent-safe-pipeline/0.3.7 on, and for no other\nclient.\nWhen escalation.mode is MANAGED and policy returns ESCALATE, Decionis\npersists the original exact intent and orchestrates the policy-issued\nPresence ceremony. The response remains non-authorizing and carries a\nmanaged_escalation status locator; no ExecutionBinding or execution\ntoken exists until signed Presence evidence is independently verified\nand current policy is evaluated again.\nThe decision carries the dossier's `verification` envelope (the same\nshare-safe page `evaluate-decision` attaches) for a client that can\nread it: one identifying itself as `agent-safe-pipeline/0.2.0` or\nlater, or as `govern/2.0.0` or later (the workflow gate), in its\nUser-Agent. Every other client receives the decision exactly as\nbefore, so a gate that mirrors this schema strictly never meets a\nfield it does not know.\nOn this operation, a `context.decionis_policy` is treated as on\nevaluate-decision: its `sha256` must be the SHA-256 of its `content`,\nand one that asks for `enforce: true` has its policy file published as\nthe workspace's enforced policy only when the key holds\n`policy:write`, `policy:*` or `org:*`; for any other key the decision\nis unaffected, nothing is published, and the response carries\n`x-decionis-warning: POLICY_ENFORCE_SCOPE_MISSING`. No other\noperation whose body or answer carries an execution intent\n(verify-token, consume-token, claim-token, or the execution grant of\n/v1/ucp/checkout/authorize) publishes a policy file or sends that\nheader, whatever the key holds.\nA key whose only evaluation scope is `decision:shadow` (an AgentSafe\nhosted gateway's) runs SHADOW and nothing else: any other mode answers\n403 DECISION_SHADOW_MODE_DENIED, a body carrying\n`context.decionis_policy`, `evidence` or `escalation` answers 400\nDECISION_SHADOW_FIELD_DENIED (naming the `field`), and the evaluation\nis recorded and signed without dispatching to the organization's\nintegrations.\nA key whose evaluation scope is `decision:enforce` (an enforced\nAgentSafe hosted gateway's) runs SHADOW or ENFORCEMENT, may open a\nmanaged escalation, and answers 400 DECISION_ENFORCE_FIELD_DENIED for a\nbody carrying `context.decionis_policy`: it never publishes policy.\nThe scopes each mode needs: SHADOW takes one of `decision:write`,\n`decision:run`, `decision:*`, `org:*`, `decision:shadow` or\n`decision:enforce`; PARALLEL and ENFORCEMENT take one of\n`decision:write`, `decision:*`, `org:*` or `decision:enforce`, so a key\nthat runs SHADOW can still answer 403 FORBIDDEN in ENFORCEMENT. The\nworkspace counts too: a provisional workspace that no owner has claimed,\nor an AWS service workspace, runs SHADOW only, and any other mode\nanswers 403 PROVISIONAL_WORKSPACE_SHADOW_ONLY (or\nSERVICE_WORKSPACE_SHADOW_ONLY) whatever the key holds, with a\n`message`. An owner claims a provisional workspace through\n`POST /v1/orgs/{org_id}/claim/start` and `/claim/verify`; claiming\ndoes not widen a key's scopes. A SHADOW success therefore says nothing\nabout whether ENFORCEMENT will be accepted.\nWhen a grant is issued under Protocol 1.1 and the intent named no\n`expected_effect_digest`, the decision is unchanged and\n`x-decionis-warning` carries EXPECTED_EFFECT_DIGEST_MISSING: that grant\naccepts no effect evidence at finalization or reconciliation, so its\neffect can never be confirmed.\nA held allowance (`/v1/authority/allowances`) is a named,\norganisation-scoped counter that policy draws on: the rule that\napproved the action names it in `then.allowance`, with the amount\nfixed or read from `action.parameters` by JSON pointer, and the\nExecutionBinding records the draw as `allowance_draws`. A grant is\nissued only once that amount is reserved against the allowance, tied\nto the grant. When it cannot be, no grant is issued and the decision\nis `BLOCK` (`should_execute` false, `execution_eligible` false,\n`execution_binding_digest` null) with one of these reason codes after\nthe evaluation's own:\n`ALLOWANCE_EXHAUSTED` (what remains, the limit less what unclaimed\ngrants reserve, what open or unknown claims hold, and what committed\nclaims consumed within the window, is less than the amount),\n`ALLOWANCE_UNDEFINED` (the organisation defines no allowance under\nthat key) or `ALLOWANCE_AMOUNT_INVALID` (the parameters give no\npositive whole amount). It is a refusal and not an ESCALATE because\nno approval creates capacity: only raising the allowance's own limit\ndoes (a top-up, which needs `policy:write` or `org:*` and so never an\nagent's key), after which the action may be proposed again. The\ndossier keeps the evaluation as it was decided; the refusal is the\nauthority's, at the moment of the grant. The claim converts the\nreservation in the transaction that consumes the grant, and\nfinalization settles it: COMMITTED keeps it, FAILED releases it,\nINDETERMINATE holds it until reconciliation, and a grant never claimed\nreleases it when it expires. An allowance is a counter and never a\nconcurrency scope: grants drawing on one allowance are claimed and\ncarried out concurrently while it has room.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionAuthorityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bound policy decision; only ALLOW carries an execution token. A draw on a held allowance that cannot be reserved answers BLOCK with ALLOWANCE_EXHAUSTED, ALLOWANCE_UNDEFINED or ALLOWANCE_AMOUNT_INVALID.",
            "headers": {
              "x-decionis-warning": {
                "$ref": "#/components/headers/DecionisWarning"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionAuthorityDecision"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Presence evidence, a presence attestation or a signed signal failed verification, MANAGED escalation was combined with human-approval evidence, or the idempotency key is already bound",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PresenceAttestationRefusal"
                    },
                    {
                      "$ref": "#/components/schemas/SignedSignalRefusal"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ExecutionAuthorityDecision"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Authority or grant store unavailable; no execution is authorized",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ExecutionAuthorityDecision"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/authority/grants": {
      "post": {
        "operationId": "createAuthorityGrant",
        "summary": "Evaluate one exact agent action and bind it to a single-use execution grant",
        "description": "The grant resource. Decionis recomputes the SHA-256 hash of the\ncanonical execution intent, evaluates policy, and issues a\nshort-lived Ed25519 execution grant only for an ALLOW evaluated in\nENFORCEMENT mode. This is the handler of the deprecated alias\n`POST /v1/authority/enforce-and-bind`, registered twice: every rule\ndocumented there (Idempotency-Key binding, Presence and attestation\nevidence, signed signals, MANAGED escalation, the verification\nenvelope by client version, `context.decionis_policy`, the\n`decision:shadow` confinement, the scopes each mode needs and the\nworkspace-owner rule, the EXPECTED_EFFECT_DIGEST_MISSING warning, and\nthe BLOCK when a held allowance cannot be reserved) applies here\nunchanged.\n\nThe issued grant is addressed afterwards as\n`/v1/authority/grants/{grantId}`, where `grantId` is the grant's\n`jti`: the `execution_token_jti` of this response, the `jti` recorded\nfor the grant, and the `jti` claim of the signed execution token.\n\n`POST /v1/authority/evaluate` and `POST /v1/authority/enforce`, which\nthe legacy `@decionis/sdk-node` 0.1.0 calls and this API never served,\nanswer 410 `LEGACY_AUTHORITY_ROUTE_RETIRED` naming this route and\n`@decionis/sdk`, which replaces that package.\n\n`executor` (optional) says who will carry the grant out. It is never\npart of the canonical intent, its hash, or the grant's binding. When\n`executor.style` is `permit` and a grant was issued, the decision also\ncarries `permit_id` (the grant's jti), `intent_sha256` (the intent\nhash as bare hex, written as `dossier_sha256` is) and `expires_at`\n(`execution_token_expires_at`). Without `executor`, or with\n`dispatch`, the response is exactly the enforce-and-bind response. A\nMANAGED escalation's locator-only summary carries no grant, so it never\ncarries permit fields.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionAuthorityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bound policy decision; only ALLOW carries an execution token",
            "headers": {
              "x-decionis-warning": {
                "$ref": "#/components/headers/DecionisWarning"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionAuthorityDecision"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Presence evidence, a presence attestation or a signed signal failed verification, MANAGED escalation was combined with human-approval evidence, or the idempotency key is already bound",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PresenceAttestationRefusal"
                    },
                    {
                      "$ref": "#/components/schemas/SignedSignalRefusal"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ExecutionAuthorityDecision"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Authority or grant store unavailable; no execution is authorized",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ExecutionAuthorityDecision"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/authority/grants/{grantId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/GrantId"
        }
      ],
      "get": {
        "operationId": "getAuthorityGrant",
        "summary": "Read and verify an execution grant without consuming it",
        "description": "The handler of the deprecated alias `POST /v1/execution/verify-token`.\nA GET carries no body, so the execution token is presented in the\n`x-decionis-execution-token` header (required; never logged) and the\nintent hash, optionally, as the `intent_hash` query parameter.\n\nVerifies the token's Ed25519 signature, issuer and lifetime; that the\ncaller is authorised for the organisation the grant names (the caller's\nown organisation for an organisation API key); that the token's `jti`\nis `{grantId}` (otherwise 409 `GRANT_ID_MISMATCH`); and, when\n`intent_hash` is supplied, that the grant is bound to it (otherwise 409\n`GRANT_BINDING_MISMATCH`). The intent hash commits to the tenant,\nactor, action and downstream target the alias checks field by field.\nReading a grant never authorizes execution: only a claim does.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/ExecutionTokenHeader"
          },
          {
            "name": "intent_hash",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Valid grant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing `x-decionis-execution-token`, or an invalid grant id or query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Grant invalid or expired, GRANT_ID_MISMATCH, or GRANT_BINDING_MISMATCH",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Grant verification unavailable; no execution is authorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/authority/grants/{grantId}/claims": {
      "parameters": [
        {
          "$ref": "#/components/parameters/GrantId"
        }
      ],
      "post": {
        "operationId": "createAuthorityGrantClaim",
        "summary": "Revalidate and atomically claim a grant once, immediately before commit",
        "description": "The handler of the deprecated aliases `POST /v1/execution/claim-token`\nand `POST /v1/execution/consume-token`, with the same body and the same\nresponses: execution is authorized only when `should_execute` is\n`true`, `claim_token` is non-null and `claim_lease_expires_at` is still\nlive at the downstream boundary, and a live claim returns\n`claim_attestation`. The verified token's `jti` must be `{grantId}`;\notherwise the answer is 409 `GRANT_ID_MISMATCH` and nothing is claimed.\nWhen the grant's binding draws on a held allowance (`allowance_draws`),\nthe claim converts the grant's reservation in the same transaction\nthat consumes the grant and inserts its concurrency scopes. A grant\nwhose reservation is not live cannot be claimed: the answer is 409\n`NONCE_REPLAY_DETECTED`, as for any grant that can no longer be\nconsumed, and nothing is claimed.\n\nA live claim must be finalized at `/receipts` (alias\n`/v1/execution/finalize-token`) before `claim_lease_expires_at`, with\nCOMMITTED, FAILED or INDETERMINATE; the 200 says so in\n`x-decionis-action-required: FINALIZE_BEFORE_LEASE_EXPIRY`. A claim\nleft unfinalized past its lease is recorded INDETERMINATE and keeps\nits concurrency scopes (its execution target and bound material\nsignals): every later claim on any of them answers 409 REVIEW\n`CURRENT_STATE_UNRESOLVED` with `evidence.nonce_claim_state`\nINDETERMINATE, and `x-decionis-blocking-grant` names the grant whose\nclaim holds the scope, until that attempt is reconciled at\n`/v1/authority/grants/{grantId}/reconciliations`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionClaimTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorization remains valid and the nonce is claimed",
            "headers": {
              "x-decionis-action-required": {
                "$ref": "#/components/headers/DecionisActionRequired"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionClaimTokenResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Structured fail-closed revalidation outcome, including GRANT_ID_MISMATCH and CURRENT_STATE_UNRESOLVED",
            "headers": {
              "x-decionis-blocking-grant": {
                "$ref": "#/components/headers/DecionisBlockingGrant"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Current state cannot be resolved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/authority/grants/{grantId}/receipts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/GrantId"
        }
      ],
      "post": {
        "operationId": "createAuthorityGrantReceipt",
        "summary": "Record the outcome of a claimed downstream commit attempt",
        "description": "The handler of the deprecated alias `POST /v1/execution/finalize-token`,\nwith the same body, rules and responses: COMMITTED, FAILED or\nINDETERMINATE, effect confirmation only from accepted digest-bound\n`effect_evidence`, a verifying provider's `effect_receipt` recorded as\npresented, and lease-expiry recorded as INDETERMINATE. The verified\ntoken's `jti` must be `{grantId}`; otherwise the answer is 409\n`GRANT_ID_MISMATCH` and nothing is recorded.\n\nA permit-style platform may add `native_receipt`, what the platform\nitself recorded when it carried the action out. It is recorded as\n`downstream_evidence.native_receipt`, so the claim and its commit\nevidence carry it; it is the executor's report of the attempt and\nnever effect confirmation by itself.\n\nA finalization that contradicts its binding opens an assumption\nbreach in the grant's action and target, reported as\n`assumption_breach`: effect evidence naming an observed effect other\nthan the expected one (`EFFECT_MISMATCH`), or a verified receipt that\neffected another effect, effected what the executor reports FAILED,\nor refused what it reports COMMITTED (`EFFECT_RECEIPT_CONTRADICTION`).\nAn unverified receipt opens nothing. The breach never changes the\nfinalization's answer.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionFinalizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Claim finalized and commit evidence recorded or queued for recovery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionFinalizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid finalization, native receipt or effect-evidence shape",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Invalid, replayed, non-claimed, or lease-expired authorization, or GRANT_ID_MISMATCH. An expired claim reports outcome INDETERMINATE and CLAIM_LEASE_EXPIRED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionFinalizeResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/authority/grants/{grantId}/reconciliations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/GrantId"
        }
      ],
      "post": {
        "operationId": "createAuthorityGrantReconciliation",
        "summary": "Report how an INDETERMINATE execution of this grant resolved",
        "description": "An executor holding the grant reports, from its own downstream\nreconciliation, whether an INDETERMINATE execution COMMITTED or\nFAILED. The nonce stays burned and the action is never retried: the\nresolution is an append-only record with digest-bound effect evidence,\nand its commit evidence goes to the Decision Chain. The same evidence\nrules as the platform operator's reconciliation apply.\n\nThe execution token (accepted after its expiry, as at finalization)\nmust verify, its `jti` must be `{grantId}` (otherwise 409\n`GRANT_ID_MISMATCH`), its correlation must be `commit_correlation_id`,\nand `claim_token` must be the token of the grant's claim (otherwise\n409 `CLAIM_TOKEN_MISMATCH`). The caller needs `decision:write`,\n`decision:*` or `org:*` in the grant's organisation. The authenticated\nprincipal is the reconciler and the only trusted observer of the\neffect evidence; it is never named in the body. An organisation API\nkey reconciles only when it is on the trusted effect-observer\nallow-list; any other caller is answered 409\n`EFFECT_OBSERVER_PROVENANCE_UNAVAILABLE`. A claim that is not\nINDETERMINATE answers 409 `CLAIM_NOT_INDETERMINATE`.\n\nEvidence bound to the grant that names an observed effect other than\nthe expected one cannot resolve the claim (409\n`EFFECT_EVIDENCE_INSUFFICIENT_FOR_RECONCILIATION`, the claim stays\nINDETERMINATE) and opens an assumption breach in the grant's action\nand target (`RECONCILIATION_CONTRADICTION`), reported as\n`assumption_breach`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionGrantReconciliationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reconciled; commit evidence acknowledged by the Decision Chain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionGrantReconciliationResponse"
                }
              }
            }
          },
          "202": {
            "description": "Reconciled; commit evidence queued for delivery (COMMIT_EVIDENCE_PENDING)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionGrantReconciliationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "description": "No claim of this grant in the organisation (INDETERMINATE_CLAIM_NOT_FOUND)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionGrantReconciliationResponse"
                }
              }
            }
          },
          "409": {
            "description": "Invalid token, GRANT_ID_MISMATCH, EXECUTION_CORRELATION_MISMATCH, CLAIM_TOKEN_MISMATCH, CLAIM_NOT_INDETERMINATE, CLAIM_ALREADY_RECONCILED, or effect evidence that cannot resolve the claim",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionGrantReconciliationResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Reconciliation store unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionGrantReconciliationResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/authority/allowances": {
      "get": {
        "operationId": "listAuthorityAllowances",
        "summary": "List the organisation's held allowances, with what each one holds",
        "description": "Every allowance the organisation defines, with its usage now:\n`reserved` by grants not yet claimed and not expired, `held` by\nclaims whose outcome is open or unknown (CLAIMED, INDETERMINATE),\n`consumed` by committed claims within the window (all of them when\n`window_seconds` is null), and what is `available` to the next\ngrant. Requires policy:read, policy:write or org:* scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "The organisation's allowances, in key order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorityAllowanceListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/authority/allowances/{allowanceKey}": {
      "parameters": [
        {
          "name": "allowanceKey",
          "in": "path",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/AuthorityAllowanceKey"
          }
        }
      ],
      "get": {
        "operationId": "getAuthorityAllowance",
        "summary": "Read one held allowance and what it holds",
        "description": "The allowance and its usage, as listed. Requires policy:read, policy:write or org:* scope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "The allowance and its usage now",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorityAllowance"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "put": {
        "operationId": "putAuthorityAllowance",
        "summary": "Define a held allowance, or change its limit or window",
        "description": "Defines the allowance under `{allowanceKey}`, or replaces its unit,\nlimit, window and description. Raising the limit is a top-up: the\nnext grant drawing on it sees the room at once. Lowering it below\nwhat is reserved, held and consumed refuses every new draw until\nenough settles or leaves the window; reservations already made stay\nvalid. A policy rule names the key in `then.allowance`, and a draw on\na key no allowance is defined under is refused as\n`ALLOWANCE_UNDEFINED`. Requires policy:write or org:* scope, so an\nagent's `decision:write` key can never raise the limit it draws on.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthorityAllowanceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The allowance as now defined, with its usage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorityAllowance"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/authority/escalations/{escalationId}": {
      "parameters": [
        {
          "name": "escalationId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "org_id",
          "in": "query",
          "required": false,
          "description": "Organization UUID. Required for platform-authenticated callers;\norganization API keys derive and enforce their organization from the\nauthenticated credential.\n",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getManagedAuthorityEscalation",
        "summary": "Read Decionis-managed Presence authorization status",
        "description": "Returns tenant-scoped orchestration state without exposing Presence\ncredentials, invitation locators, authentication assertions, or biometric\nmaterial. A normal execution grant is present only at GRANT_READY, after\nDecionis has independently verified Presence evidence and re-evaluated\ncurrent policy for the original exact intent.\n",
        "responses": {
          "200": {
            "description": "Current managed escalation state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedEscalationStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "cancelManagedAuthorityEscalation",
        "summary": "Cancel a pending Decionis-managed Presence escalation",
        "responses": {
          "200": {
            "description": "Cancelled or already-terminal managed escalation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedEscalationStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/authority/escalations/{escalationId}/approval": {
      "parameters": [
        {
          "name": "escalationId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "org_id",
          "in": "query",
          "required": false,
          "description": "Organization UUID. Required for platform-authenticated callers;\norganization API keys derive and enforce their organization from the\nauthenticated credential.\n",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getManagedAuthorityEscalationApproval",
        "summary": "Read the Presence authority request a managed escalation asks a person to prove",
        "description": "For the caller that opened the escalation, so that a decision case of\nits own can name the same Presence request as its step-up and one\npasskey ceremony answers both. `authority_request_id` is null until\nPresence has the request, and for an approval chain, where each tier\nmember has a request of their own. It is never approval evidence and\ncarries no invitation, assertion or grant.\n",
        "responses": {
          "200": {
            "description": "The escalation's Presence authority request, when there is a single one",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedEscalationApproval"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/authority/presence-completions": {
      "post": {
        "operationId": "notifyManagedPresenceCompletion",
        "summary": "Notify Decionis that signed Presence proof may be ready",
        "description": "Service-to-service recovery hint. The body is never authorization.\nDecionis locates the tenant-bound escalation, fetches the signed Presence\ndossier, verifies it independently, and performs current-policy\nre-authorization before any grant can be issued. Duplicate notifications\nare idempotent.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PresenceAuthorityCompletion"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Completion hint accepted or idempotently replayed"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/authority/plans": {
      "post": {
        "operationId": "registerGovernedPlan",
        "summary": "Register a governed plan; it authorizes no step",
        "description": "Registers one change carried out as several governed operations\n(`agent-safe.plan/1`): its steps, a coupling per dependency edge, a\npartial-commit rule and the compensation steps a failure opens. The\nplan is a governance object, not an orchestrator: registering it\nauthorizes nothing, and every step is still decided by\nenforce-and-bind and claimed before it commits, with a grant of its\nown. A step's intent names the plan it belongs to in its hashed\ncontext (`agent_safe.plan`: `plan_id`, `plan_digest`, `step_id`);\nDecionis derives the step's facts from the plan and its own claim\nrecords and writes them under `agent_safe.plan` for policy to read,\nand binds the step's view of the plan as a material signal the claim\nrechecks. Plans are immutable: the same `plan_id` with another digest\nis refused. One organisation in v1: `tenant_id` must be the caller's.\nRequires decision:write, decision:* or org:*.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GovernedPlan"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The same plan was already registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GovernedPlanRegistration"
                }
              }
            }
          },
          "201": {
            "description": "Plan registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GovernedPlanRegistration"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/authority/plans/{planId}": {
      "get": {
        "operationId": "getGovernedPlan",
        "summary": "Read a governed plan's state and each step's status",
        "description": "The plan as registered, its state and each step's status, derived\nnow from the claim records of every grant issued for one of its\nsteps: `COMMITTED` only with a confirmed effect. `PARTIAL` (a step\nfailed after others committed) stays so once reached and maps to the\nSCITT execution profile's `partially_completed`; `SUSPENDED` (a step's\noutcome is unknown) lasts until reconciliation settles it.\n",
        "parameters": [
          {
            "name": "planId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]*$"
            }
          },
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "The plan and its state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GovernedPlanStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/execution/verify-token": {
      "post": {
        "operationId": "verifyAgentExecutionToken",
        "deprecated": true,
        "summary": "Verify an execution grant without consuming it",
        "description": "Deprecated alias of `GET /v1/authority/grants/{grantId}`: the same\nhandler, fed the token and the full intent from a body.\n\nVerifies the Ed25519 signature, issuer, audience, lifetime, action,\nactor, tenant, and exact intent hash. This endpoint does not authorize\nexecution by itself because it does not atomically consume the grant.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Valid grant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Grant invalid, expired, or not bound to the supplied intent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Grant verification unavailable; no execution is authorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/execution/consume-token": {
      "post": {
        "operationId": "consumeAgentExecutionToken",
        "deprecated": true,
        "summary": "Compatibility alias for pre-commit claim and revalidation",
        "description": "Deprecated alias of `POST /v1/authority/grants/{grantId}/claims`: the\nsame handler.\n\nThe same handler as `/v1/execution/claim-token`, with the same body and\nresponses. New adapters should use the explicit claim route and must\nfinalize the claim before `claim_lease_expires_at`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionClaimTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Binding revalidated and nonce claimed; caller may execute once",
            "headers": {
              "x-decionis-action-required": {
                "$ref": "#/components/headers/DecionisActionRequired"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionClaimTokenResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Stale authorization, replay, binding mismatch, or unresolved state",
            "headers": {
              "x-decionis-blocking-grant": {
                "$ref": "#/components/headers/DecionisBlockingGrant"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Revalidation state or claim store unavailable; no execution is authorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/execution/claim-token": {
      "post": {
        "operationId": "claimExecutionBoundDossier",
        "deprecated": true,
        "summary": "Revalidate and atomically claim one execution-bound authorization",
        "description": "Deprecated alias of `POST /v1/authority/grants/{grantId}/claims`: the\nsame handler.\n\nRequired immediately before the downstream commit. Verifies the dossier\nsignature and complete execution binding, resolves current policy,\nsignal, and Presence state, then atomically claims the nonce and mutable\nconcurrency scope. Execution is authorized only when `should_execute`\nis `true`, `claim_token` is non-null, and `claim_lease_expires_at` is\nstill live at the downstream boundary. `valid` alone is diagnostic;\nin SHADOW it may describe hypothetical validity without execution\nauthority.\n\nA live claim also returns `claim_attestation`: a compact EdDSA JWS,\nsigned with the execution-grant key, that a downstream system of\nrecord can verify offline against\n`/.well-known/decionis-execution-grant-jwks.json`. It names the\ngrant, the decision, the dossier, the binding the grant carried\n(intent hash, canonical payload digest and its profile, expected\neffect digest, nonce, correlation), a digest of the claim token, and\nan expiry equal to the claim lease. The executor forwards it with the\ndownstream request; the provider checks that the request it received\nis the one the attestation describes. See `ClaimAttestationClaims`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionClaimTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorization remains valid and the nonce is claimed",
            "headers": {
              "x-decionis-action-required": {
                "$ref": "#/components/headers/DecionisActionRequired"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionClaimTokenResponse"
                }
              }
            }
          },
          "409": {
            "description": "Structured fail-closed revalidation outcome",
            "headers": {
              "x-decionis-blocking-grant": {
                "$ref": "#/components/headers/DecionisBlockingGrant"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          },
          "503": {
            "description": "Current state cannot be resolved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/decionis-execution-grant-jwks.json": {
      "get": {
        "operationId": "getExecutionGrantJwks",
        "summary": "Public keys for execution grants and claim attestations",
        "security": [],
        "description": "The Ed25519 public keys, as a JWKS, that sign execution grants and\nclaim attestations. A deploy target or a downstream system of record\nverifies either offline against this set; during a signing-key\nrotation the previous key stays listed until the grants signed with\nit have drained. The `kid` in a token's protected header names the\nkey to use.\n",
        "responses": {
          "200": {
            "description": "The current verification keys",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionGrantJwks"
                }
              }
            }
          },
          "404": {
            "description": "Execution-grant signing is not configured for this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/edge/policy-bundles/current": {
      "get": {
        "operationId": "getCurrentSignedPolicyBundle",
        "summary": "Issue the organization's active policy bundle, signed for the edge evaluator",
        "description": "Signs the bundle hosted evaluation would run on right now and returns it\nas a compact JWS for the Decionis edge evaluator (the WebAssembly policy\ncore a deployment runs inside its own network). The edge evaluator\nevaluates only bundles Decionis signed: it verifies the signature\nagainst the keys its release pins (published at\n`/.well-known/decionis-policy-bundle-jwks.json`), the audience against\nits organization, the validity window against the time its host\nsupplies, and the bundle against `bundle_digest`.\n\nSelection is hosted evaluation's own: the newest active bundle whose\neffective window contains now and that passes the maker-checker gate,\nor, when `policy_version` is given, exactly that version among them. An\nunapproved, historical, not-yet-effective or expired bundle is never\nsigned; like hosted evaluation, it is treated as not active and the\nanswer is `404 POLICY_BUNDLE_NOT_FOUND` with the policy guard's reason.\n\nThe signed bundle lives `ttl_seconds` (default 7 days, at most 30 days\nand at most the organization's plan maximum), never past the bundle's\nown `effective_to`. Every issuance is recorded before it is returned\n(see `GET /v1/edge/policy-bundles/issuances`); one that cannot be\nrecorded is not issued. Requires an organization API key with\n`policy:read` (or `policy:*` / `org:*`); keys without explicit scopes\nare refused.\n\nOnly organizations licensed for the edge evaluator receive bundles:\nEnterprise and self-managed plans include it, Premium with the edge\nadd-on, and an operator may list an organization for a pilot. Any\nother organization is answered `403 EDGE_EVALUATOR_NOT_ENTITLED`\n(its signed entitlement, `GET /v1/edge/entitlement`, says why).\n\nThe bundle is `core_abi: 3`: it also carries what hosted would decide\ndifferently for this organization, resolved with hosted's own code —\n`vertical_pack` (its configured pack, or the operator's pack\noverride, else null) and `max_mode` / `max_mode_reason` (SHADOW with\nhosted's 403 code for an unclaimed provisional or AWS service\nworkspace, else ENFORCEMENT). An edge module older than ABI 3 refuses\nsuch a bundle rather than decide without them. A bundle whose rules\ncompare two facts (`EQ_FACT`, `NEQ_FACT`) is `core_abi: 7`, which an\nedge module older than ABI 7 refuses the same way, and one that\ndeclares `allowed_transitions` is `core_abi: 8`, which an edge module\nolder than ABI 8 refuses.\nA bundle with a rule that draws on a held allowance (`then.allowance`)\nis never signed for an edge: only hosted Decionis holds an allowance,\nand an edge module would approve such a rule with nothing reserved.\n",
        "parameters": [
          {
            "name": "decision_domain",
            "in": "query",
            "required": false,
            "description": "Recorded with the issuance. The bundle carries the rules of every decision domain; the domain is chosen per evaluation, so it does not change which bundle is signed.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[A-Za-z0-9_.:-]+$"
            }
          },
          {
            "name": "policy_version",
            "in": "query",
            "required": false,
            "description": "Sign exactly this version; it must be active and approved.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "ttl_seconds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 60,
              "maximum": 2592000,
              "default": 604800
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The signed bundle; private and not cacheable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedPolicyBundleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Not authenticated with an organization API key (`ORG_API_KEY_REQUIRED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Missing `policy:read` (`FORBIDDEN`), or the organization is not licensed for the edge evaluator (`EDGE_EVALUATOR_NOT_ENTITLED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The organization has no active, approved bundle (of the requested version)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyBundleNotFound"
                }
              }
            }
          },
          "409": {
            "description": "`POLICY_BUNDLE_VALIDITY_WINDOW_EMPTY`: the active bundle's effective window ends before a signed bundle could become valid; or `POLICY_BUNDLE_REQUIRES_HOSTED_ALLOWANCE`: a rule draws on a held allowance, which only hosted Decionis holds, so nothing was signed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "`POLICY_BUNDLE_RESOLUTION_FAILED`: the active bundle could not be resolved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`POLICY_BUNDLE_SIGNING_NOT_CONFIGURED`, `POLICY_BUNDLE_ORG_MODE_UNAVAILABLE` (the organization's enforcement mode could not be resolved, so nothing was signed), or `POLICY_BUNDLE_ISSUANCE_UNAVAILABLE` (the issuance could not be recorded, so nothing was issued)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/edge/policy-bundles/issuances": {
      "get": {
        "operationId": "listPolicyBundleIssuances",
        "summary": "List the signed policy bundles issued to the organization",
        "description": "The record of every signed policy bundle issued to the authenticated\norganization, newest first: its `jti`, bundle, version, digest, signing\nkey, validity window and the API key that requested it. Requires an\norganization API key with `policy:read` (or `policy:*` / `org:*`).\n",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The issuances; private and not cacheable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyBundleIssuanceList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/edge/entitlement": {
      "get": {
        "operationId": "getEdgeEntitlement",
        "summary": "The organization's signed edge-evaluator entitlement",
        "description": "A compact JWS stating what the authenticated organization is licensed\nfor: its plan, deployment tier (`hosted` | `dedicated` |\n`self_managed`), included governed actions per month, volume band\n(self-managed only), whether the edge evaluator is included (`edge`),\nand how many days after a month ends its usage report is due. Valid\n35 days. Issued to every organization, entitled or not: an edge\ninstallation verifies it against the policy-bundle JWKS\n(`/.well-known/decionis-policy-bundle-jwks.json`; same key, its own\n`typ`) and uses it only to warn — a licence problem never stops or\ndegrades a decision. Requires an organization API key with\n`policy:read` (or `policy:*` / `org:*`).\n",
        "responses": {
          "200": {
            "description": "The signed entitlement; private and not cacheable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeEntitlementResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "`EDGE_ENTITLEMENT_SIGNING_NOT_CONFIGURED`, or `EDGE_ENTITLEMENT_UNAVAILABLE` (the licence could not be read)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/edge/usage-reports": {
      "post": {
        "operationId": "submitEdgeUsageReport",
        "summary": "Submit an edge installation's signed monthly usage report",
        "description": "An edge installation counts the governed actions it decided per UTC\nmonth from its hash-chained evidence and reports them as a compact\nJWS (`EdgeUsageReportHeader`, `EdgeUsageReportClaims`) signed with an\nEd25519 key the organization registered at\n`/v1/execution/provider-keys` with purpose `usage_report` and the\ninstallation id as its `issuer`.\n\nVerified like an effect receipt: the header, the key (this\norganization's, this purpose only), the signature, `iss` = the key's\nissuer, `aud` = the organization, `iat` at most 5 minutes ahead, a\nmonth that has begun, and claims that add up (each breakdown sums to\n`total`, `delegated` <= `total`, the chain range present exactly when\nsomething was counted, `period_start`/`period_end` the month's\nbounds). A refused report is answered 422 with its code and not\nstored.\n\nOne report per installation and month is current. The same report\nagain is answered 200 with the stored record (`replay: true`). A\ndifferent report for the same installation and month is accepted\nonly when it counts further along the same chain stream (a higher\n`chain.last_seq`): it supersedes the current one, which stays on\nrecord pointing at it; otherwise 409.\n\nA stored report adds `total - delegated` governed actions (minus what\nearlier reports for that installation and month already metered) to\nthe organization's usage through the governed-action meter hosted\ndecisions use, dated in the reported month when the meter still\naccepts it, so plans, allowances and overage apply unchanged.\n`delegated` decisions were decided by hosted Decionis, which metered\nthem already. Metering is fail-open: the report is recorded either\nway, with `meter_status`.\n\nRequires an organization API key with `policy:read`, `policy:write`,\n`policy:*` or `org:*`: the report's signature, not the API key, is\nwhat is trusted.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EdgeUsageReportSubmission"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The same report was already recorded (`replay` true)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeUsageReportAccepted"
                }
              }
            }
          },
          "201": {
            "description": "Recorded (and metered, see `meter_status`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeUsageReportAccepted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "The report does not supersede the current one for its installation and month",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeUsageReportConflict"
                }
              }
            }
          },
          "422": {
            "description": "The report was refused; nothing was recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeUsageReportRefusal"
                }
              }
            }
          },
          "503": {
            "description": "`USAGE_REPORT_KEYS_UNAVAILABLE` or `USAGE_REPORT_UNAVAILABLE`: nothing was recorded; send it again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listEdgeUsageReports",
        "summary": "List the organization's edge usage reports",
        "description": "Every usage report recorded for the authenticated organization,\nnewest first, superseded ones included (`superseded_by`), optionally\nfor one month. The report JWS itself is kept as evidence and not\nreturned. Requires an organization API key with `policy:read`,\n`policy:write`, `policy:*` or `org:*`.\n",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^2[0-9]{3}-(0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The reports; private and not cacheable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeUsageReportList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/.well-known/decionis-policy-bundle-jwks.json": {
      "get": {
        "operationId": "getPolicyBundleJwks",
        "summary": "Public keys for signed policy bundles",
        "security": [],
        "description": "The Ed25519 public keys, as a JWKS, that sign policy bundles for the\nedge evaluator. An edge evaluator release pins these keys at build\ntime; during a signing-key rotation the previous key stays listed until\nthe bundles signed with it have expired. The `kid` in a signed bundle's\nprotected header names the key to use.\n",
        "responses": {
          "200": {
            "description": "The current verification keys",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyBundleJwks"
                }
              }
            }
          },
          "404": {
            "description": "Policy bundle signing is not configured for this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/execution/finalize-token": {
      "post": {
        "operationId": "finalizeExecutionBoundDossier",
        "deprecated": true,
        "summary": "Finalize a claimed downstream commit attempt",
        "description": "Deprecated alias of `POST /v1/authority/grants/{grantId}/receipts`:\nthe same handler.\n\nRecords COMMITTED, FAILED, or INDETERMINATE. INDETERMINATE effects must\nbe reconciled and are never safe for automatic retry. A COMMITTED claim\nproves an attempt was finalized, but an effect is confirmed only when\ndigest-bound `effect_evidence` with status CONFIRMED is accepted. If the\nsigned grant expires after a successful claim, finalization may continue\nonly while the exact persisted claim token, nonce, correlation, and\ndatabase claim lease remain valid. An expired unclaimed grant is never\nexecution-eligible. A finalize request at or after the database-clock\nlease boundary fails closed and atomically records the claim as\nINDETERMINATE.\n\nA verifying provider's signed effect receipt (Verifying Provider\nProfile, VP-3) may accompany the finalization as `effect_receipt`. It\nis verified against the organisation's registered provider keys and\nrecorded in the commit evidence as presented, verified or not; it is\nnever a reason to refuse the finalization. When the grant named the\neffect it expected and the verified receipt carries an effect digest,\nthe receipt is also read as `SIGNED_RECEIPT` effect evidence, and\nconfirms the effect only when the digests agree and the outcome is\nCOMMITTED. An explicit `effect_evidence` takes precedence.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionFinalizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Claim finalized and commit evidence recorded or queued for recovery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionFinalizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid finalization or effect-evidence shape",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Invalid, replayed, non-claimed, or lease-expired authorization. An expired claim reports outcome INDETERMINATE and CLAIM_LEASE_EXPIRED. A corrupt claim missing its claimed scope is also forced INDETERMINATE and reports CLAIM_SCOPE_INVARIANT_VIOLATION.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionFinalizeResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/execution/provider-keys": {
      "post": {
        "operationId": "registerExecutionProviderKey",
        "summary": "Register a public key for effect receipts, presence attestations, edge usage reports or signed signals",
        "description": "Registers only the public half of the Ed25519 key a system of record\nsigns effect receipts with, or a presence provider signs presence\nattestations with, under the issuer it names in `iss`. `purpose`\n(default `effect_receipt`) says which: a key only ever verifies its\nown purpose, so an effect-receipt key never verifies an attestation\nand an attestation key never verifies a receipt. An edge\ninstallation registers its usage-report key with purpose\n`usage_report` and its installation id as `issuer`. A producer of\nsigned signals (a card-presence provider's Tap to Authenticate, say)\nregisters its key with purpose `signed_signal` and the producer id\nthe signals name as `iss` as `issuer`; an admitted presence\nprovider's JWKS keys sign its signals without registration.\nPrivate key material is rejected. Registering the same `kid` again\nreplaces the key (and its purpose) and clears its revocation.\nRequires policy:write or org:* scope.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionProviderKeyRegistrationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Public verification key registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionProviderKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listExecutionProviderKeys",
        "summary": "List active and revoked provider keys, with their purpose",
        "parameters": [
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "Provider-key inventory, public metadata only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionProviderKeyListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/execution/provider-keys/{kid}": {
      "delete": {
        "operationId": "revokeExecutionProviderKey",
        "summary": "Revoke, but retain, a provider key",
        "description": "A revoked key verifies no further receipts or attestations, and a grant admitted by an attestation under it can no longer be claimed. Its metadata remains, so what was recorded against it stays explicable.",
        "parameters": [
          {
            "name": "kid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "Key revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionProviderKeyRevocationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/presence-providers": {
      "get": {
        "operationId": "listPresenceProviders",
        "summary": "The directory of presence providers a policy may name",
        "description": "Third parties that prove a person was present for an intent, such as a card issuer's partner proving the cardholder tapped their own card (method CARD_TAP). Decionis operates the directory; each entry names the provider's attestation `iss` and the JWKS it publishes its Ed25519 keys at. An organisation trusts a provider only once it admits it (PUT /v1/execution/presence-providers/{provider_id}/admission). Requires policy:read, policy:write or org:* scope.",
        "responses": {
          "200": {
            "description": "Active directory entries",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PresenceProviderDirectory"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/execution/presence-providers": {
      "get": {
        "operationId": "listPresenceProviderAdmissions",
        "summary": "The presence providers this organisation admitted, revoked ones included",
        "parameters": [
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "Admissions with their provider's public metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PresenceProviderAdmissionList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/execution/presence-providers/{provider_id}/admission": {
      "put": {
        "operationId": "admitPresenceProvider",
        "summary": "Admit a presence provider for this organisation",
        "description": "From then on an attestation signed under a key the provider's JWKS publishes verifies for this organisation, when the attestation's `iss` is the provider's. The organisation's own registered keys (POST /v1/execution/provider-keys, purpose presence_attestation) are consulted first and remain the way to pin a key by hand. Admitting again clears a revocation. Requires policy:write or org:* scope.",
        "parameters": [
          {
            "name": "provider_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_.:-]{0,63}$"
            }
          },
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "Admitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PresenceProviderAdmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "revokePresenceProviderAdmission",
        "summary": "Revoke a presence provider's admission, keeping its record",
        "description": "A revoked admission verifies no further attestations from the provider, and a grant admitted by one of its attestations can no longer be claimed. Requires policy:write or org:* scope.",
        "parameters": [
          {
            "name": "provider_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_.:-]{0,63}$"
            }
          },
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "service",
                    "provider_id",
                    "revoked"
                  ],
                  "properties": {
                    "service": {
                      "type": "string",
                      "const": "decionis"
                    },
                    "provider_id": {
                      "type": "string"
                    },
                    "revoked": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/ucp/checkout/authorize": {
      "post": {
        "operationId": "authorizeUcpCheckout",
        "summary": "Evaluate and bind authority for one UCP checkout completion",
        "description": "Accepts a complete UCP checkout response envelope negotiated at either\n2026-04-08 or 2026-08-25. The seven UCP top-level checkout fields are\nrequired and extension members remain open. August responses must also\ncarry ucp.payment_handlers; line items retain their official required\nfields and quantity floor; checkout totals contain exactly one subtotal\nand one total. Historical April callers retain the original adapter's\noptional payment-handler compatibility. Missing, ambiguous, or\nunsupported material fails before policy evaluation.\n\nDecionis authorizes; the connected merchant system remains responsible\nfor execution. An ALLOW decision is not itself an execution grant. An\nauthoritative response may carry an exact-action grant that must be\nclaimed immediately before the merchant commits the checkout, then\nfinalized as COMMITTED, FAILED, or INDETERMINATE.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UcpCheckoutAuthorizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "UCP-shaped authority result; execution authority remains fail-closed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UcpCheckoutAuthorizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported UCP checkout envelope or mandate evidence",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UcpCheckoutAuthorizeResponse"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "description": "Policy refused the completion or the credential lacks authority",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UcpCheckoutAuthorizeResponse"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "The supplied or retained authority material conflicts with the exact checkout action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UcpCheckoutAuthorizeResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "Authority unavailable; no execution is authorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UcpCheckoutAuthorizeResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ucp/signing-keys": {
      "post": {
        "operationId": "registerUcpMerchantSigningKey",
        "summary": "Register a merchant public key for UCP terms verification",
        "description": "Registers only the public half of an EC signing key. Private key\nmaterial is rejected. Requires policy:write or org:* scope.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UcpSigningKeyRegistrationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Public verification key registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UcpSigningKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listUcpMerchantSigningKeys",
        "summary": "List active and revoked UCP merchant verification keys",
        "parameters": [
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "Merchant verification-key inventory",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UcpSigningKeyListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/ucp/signing-keys/{kid}": {
      "delete": {
        "operationId": "revokeUcpMerchantSigningKey",
        "summary": "Revoke, but retain, a UCP merchant verification key",
        "description": "Revoked key metadata remains available for historical evidence verification.",
        "parameters": [
          {
            "name": "kid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "$ref": "#/components/parameters/UcpOrgId"
          }
        ],
        "responses": {
          "200": {
            "description": "Key revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UcpSigningKeyRevocationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/decisions/evaluate": {
      "post": {
        "operationId": "evaluateDecisionSdkAlias",
        "summary": "Evaluate captured execution intent through the SDK compatibility route",
        "deprecated": true,
        "description": "Backwards-compatible alias for SDKs before the canonical protocol route.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CorrelationId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Policy decision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/dossiers/{decision_id}": {
      "get": {
        "operationId": "createDossier",
        "summary": "Persist or retrieve the Decision Dossier for a decision",
        "parameters": [
          {
            "name": "decision_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Decision Dossier",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionDossier"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/decision-chains/{chain_id}": {
      "get": {
        "operationId": "getDecisionChain",
        "summary": "Retrieve workflow lineage for linked Decionis decisions",
        "description": "Returns the protocol-owned Decision Chain for a workflow. Decision\nChains link evaluated execution intents into a causal graph without\nexposing policy rules or application-side guardrail logic.\n",
        "parameters": [
          {
            "name": "chain_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Decision Chain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionChain"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/decision-chains/by-evaluation/{evaluation_id}": {
      "get": {
        "operationId": "getDecisionChainByEvaluation",
        "summary": "Retrieve authenticated workflow lineage by evaluation",
        "description": "Resolves the tenant-bound Decision Chain containing the specified\nevaluation. The credential organization must match `org_id`.\n",
        "parameters": [
          {
            "name": "evaluation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Decision Chain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionChain"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/dossiers/{dossier_id}/proof-packet": {
      "get": {
        "operationId": "getDossierProofPacket",
        "summary": "Export a single Decision Dossier as a portable, signed proof packet",
        "description": "Returns an escalation-ready proof packet for one dossier: the dossier\npayload, policy snapshot, ledger anchor, the Ed25519 proof bundle, and a\ncryptographic verification result with verify instructions. Suitable for\nrefund/overcharge dispute escalation and audit.\n",
        "parameters": [
          {
            "name": "dossier_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Signed proof packet",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionDossierProofPacket"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/dossiers/{dossier_id}/agent-action-capsule": {
      "get": {
        "operationId": "exportAgentActionCapsuleV04",
        "summary": "Export a Decision Dossier execution lifecycle as an Agent Action Capsule",
        "description": "Returns an org-scoped Agent Action Capsule pinned to\ndraft-mih-scitt-agent-action-capsule-04. The Capsule is a compatibility\nprojection; the Decision Dossier remains the canonical Decionis record.\nPlanned, dispatched, and confirmed effects are never inferred from an\nauthorization verdict alone. This release is self-attested and does not\nclaim SCITT transparency anchoring.\n",
        "parameters": [
          {
            "name": "dossier_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Draft-04 Agent Action Capsule that passed Class 1 verification",
            "headers": {
              "x-decionis-aac-profile": {
                "schema": {
                  "type": "string",
                  "const": "draft-mih-scitt-agent-action-capsule-04"
                }
              },
              "x-decionis-class1-verified": {
                "schema": {
                  "type": "string",
                  "const": "true"
                }
              }
            },
            "content": {
              "application/agent-action-capsule+json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentActionCapsuleV04"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/dossiers/{dossier_id}/agent-action-capsule/producer-envelopes": {
      "get": {
        "operationId": "exportAgentActionCapsuleProducerEnvelopesV04",
        "summary": "Export independent COSE Producer Envelopes over a Capsule ID",
        "description": "Returns a Decionis JSON carrying structure for zero or more independent\ndraft-04 Producer Envelopes. Each envelope is a tagged COSE_Sign1 whose\nattached payload is the raw 32-byte Capsule ID. A valid signature\nauthenticates the returned public key; authorization of that key for the\nCapsule operator remains caller policy. Producer Envelopes are separate\nfrom SCITT registration statements and receipts.\n",
        "parameters": [
          {
            "name": "dossier_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Independent Producer Envelope results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentActionCapsuleProducerEnvelopeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/dossiers/{dossier_id}/agent-action-capsule/scitt-registration": {
      "post": {
        "operationId": "registerAgentActionCapsuleWithScitt",
        "summary": "Asynchronously submit the current Capsule ID to an allowlisted Transparency Service",
        "description": "Creates an RFC 9943 Signed Statement over the raw Capsule ID and queues\noptional registration outside the authority hot path. The operation is\nidempotent by org, Capsule ID, and Transparency Service. A received but\nunverified receipt is persisted as `RECEIPT_UNVERIFIED` and never\nupgrades the record to anchored.\n",
        "parameters": [
          {
            "name": "dossier_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Existing verified registration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScittCapsuleRegistrationResponse"
                }
              }
            }
          },
          "202": {
            "description": "Registration queued or awaiting receipt-profile verification",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScittCapsuleRegistrationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "getAgentActionCapsuleScittRegistration",
        "summary": "Read optional SCITT registration and receipt-verification status",
        "parameters": [
          {
            "name": "dossier_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "capsule_id",
            "in": "query",
            "required": false,
            "description": "Immutable historical Capsule ID; defaults to the current lifecycle projection.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Registration status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScittCapsuleRegistrationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/dossiers/{dossier_id}": {
      "get": {
        "operationId": "getDecisionDossier",
        "summary": "Fetch one tenant-bound Decision Dossier",
        "description": "Returns the persisted Decision Dossier for an authenticated tenant. An\nENFORCEMENT-mode ESCALATE dossier carries `authority_requirement` only\nwhen a matched policy rule explicitly defines Presence authority and\nthe evaluation supplied a valid canonical `context.action_context`.\n",
        "parameters": [
          {
            "name": "dossier_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant-bound Decision Dossier",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolDecisionDossierResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/decision-chains/{chain_id}/proof-packet": {
      "get": {
        "operationId": "getDecisionChainProofPacket",
        "summary": "Retrieve an authenticated Decision Chain verification report",
        "description": "Legacy path retained for compatibility. Returns a bounded, point-in-time\nserver verification report covering the linked dossiers and chain\nintegrity known to Decionis. The compact response does not embed source\ndossier proof bundles or the canonical ledger hash path and has no\ntop-level signature. It is therefore not a portable or offline-verifiable\nproof artifact; independently verify the referenced dossiers and ledger\nevidence obtained from their authorized source.\n",
        "parameters": [
          {
            "name": "chain_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authenticated point-in-time Decision Chain verification report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionChainProofPacket"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/ops/spend-admission/verify": {
      "post": {
        "operationId": "opsSpendAdmissionVerify",
        "summary": "Govern a spend request (Gate 1 — spend admission)",
        "description": "Evaluates an expense / vendor-payment / refund / credit request against the\nops spend-control vertical pack (approval threshold + dual authorization,\nvendor verification, refund/credit limits). Runs the full shared\nevaluate-decision pipeline and returns a signed dossier reference.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CorrelationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpsGateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ops gate verdict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpsGateVerdict"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/ops/disbursement-authority/verify": {
      "post": {
        "operationId": "opsDisbursementAuthorityVerify",
        "summary": "Govern a disbursement (Gate 2 — disbursement authority)",
        "description": "Evaluates a vendor payment at release time: authorized role, segregation of\nduties, dual authorization, and duplicate-payment detection (a vendor +\ninvoice/amount fingerprint compared against prior org evaluations in the\nlookback window).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CorrelationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpsGateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ops gate verdict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpsGateVerdict"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/surfaces/decisions": {
      "post": {
        "operationId": "federateSurfaceDecision",
        "summary": "Federate a native-surface decision into the shared audit ledger",
        "description": "Records a decision made by a Layer-A commerce surface (Amazon, eBay,\nShopify) into the cross-surface SHA-256 audit ledger. When the full signed\ndossier is included it is persisted and becomes retrievable + exportable as\na proof packet; otherwise only a ledger entry is appended (backward\ncompatible).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SurfaceDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Federation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SurfaceDecisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/ebay/marketplace-account-deletion": {
      "get": {
        "operationId": "ebayAccountDeletionChallenge",
        "summary": "eBay Marketplace Account Deletion validation challenge",
        "description": "Anonymous endpoint required for an eBay PRODUCTION keyset. eBay sends a\n`challenge_code`; the response is the hex SHA-256 of\nchallengeCode + verificationToken + endpointURL. Requires\nEBAY_VERIFICATION_TOKEN and EBAY_DELETION_ENDPOINT_URL to be configured.\nNo authentication — eBay sends no credentials.\n",
        "security": [],
        "parameters": [
          {
            "name": "challenge_code",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Challenge response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EbayChallengeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "ebayAccountDeletionNotification",
        "summary": "eBay Marketplace Account Deletion notification",
        "description": "Anonymous endpoint that receives an eBay account-deletion notification and\nacknowledges it. Decionis stores no eBay consumer PII, so there is nothing\nto purge beyond acknowledgement.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketplaceDeletionNotification"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/policies": {
      "post": {
        "operationId": "createPolicy",
        "summary": "Create a policy, or create it MANAGED from a system scaffold",
        "description": "Account session of a writing workspace member; same-site JSON and an Idempotency-Key are required. With content, the caller authors revision 1 and holds POLICY_OWNER and AUTHOR. With governance MANAGED and no content, the system writes revision 1 as a scaffold with no author, the caller holds POLICY_OWNER and RELEASE_APPROVER (never AUTHOR), the named desk analysts receive their bounded roles, and MANAGED governance takes the scaffold as its baseline, all in one journaled command. Alias kept on the same handler /v1/public/account/workspace/policy-platform.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "required": [
                      "environment",
                      "content"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "environment": {
                        "type": "string",
                        "enum": [
                          "sandbox",
                          "production"
                        ]
                      },
                      "content": {
                        "type": "object",
                        "description": "The revision's content. Of its properties, the contract pins the two a release carries into its signed manifest; the rest are the policy document.",
                        "additionalProperties": true,
                        "properties": {
                          "actionManifest": {
                            "oneOf": [
                              {
                                "type": "null"
                              },
                              {
                                "$ref": "#/components/schemas/ActionManifest"
                              }
                            ]
                          },
                          "assumptions": {
                            "type": "array",
                            "maxItems": 30,
                            "items": {
                              "$ref": "#/components/schemas/PolicyAssumption"
                            }
                          }
                        }
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "environment",
                      "governance",
                      "desk",
                      "reason"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "environment": {
                        "type": "string",
                        "enum": [
                          "sandbox",
                          "production"
                        ]
                      },
                      "governance": {
                        "type": "string",
                        "enum": [
                          "MANAGED"
                        ]
                      },
                      "desk": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 12,
                        "description": "Desk analysts' grants; at least one AUTHOR, each expiring within 30 days.",
                        "items": {
                          "type": "object",
                          "required": [
                            "userId",
                            "role",
                            "expiresAt"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "userId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "AUTHOR",
                                "TECHNICAL_REVIEWER",
                                "TEST_APPROVER"
                              ]
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      },
                      "reason": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The policy, in DRAFT, with its first revision.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/policies/validate": {
      "post": {
        "operationId": "validatePolicy",
        "summary": "Validate an encoded policy document",
        "parameters": [
          {
            "$ref": "#/components/parameters/CorrelationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Policy validation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyValidationResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases": {
      "get": {
        "operationId": "listCases",
        "summary": "List the decisions waiting for a person",
        "description": "Core's façade over every case owner (Core protocol escalations, procurement referrals, policy proposals and signed findings; Commerce managed cases). Organization API key with decision:read. Case state stays with its owner; Core keeps only the owner reference and delivery receipts. Business Central asserts its signed-in user with `x-decionis-actor: entra:<tenant id>:<object id>` inside the tenant its connection credential proves; an MCP OAuth token names its own user. Without a person every card is listed with `can_decide` false. `GET /v1/protocol/decisions/awaiting-approval` is a deprecated alias on the same handler and keeps its original query and response.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending"
              ],
              "default": "pending"
            }
          },
          {
            "name": "view",
            "in": "query",
            "description": "card (decionis.delivery.card/1), business-central (flat page payload) or assistant (MCP structured content).",
            "schema": {
              "type": "string",
              "enum": [
                "card",
                "business-central",
                "assistant"
              ],
              "default": "card"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          },
          {
            "name": "x-decionis-actor",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^entra:[0-9a-f-]{36}:[0-9a-f-]{36}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pending cases in the requested view; `partial` is true when an owner was unreachable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "cases",
                    "partial"
                  ],
                  "properties": {
                    "cases": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "partial": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/cases/{caseId}": {
      "parameters": [
        {
          "name": "caseId",
          "in": "path",
          "required": true,
          "description": "`<owner>:<kind>:<ref>`, for example `commerce:payment:<uuid>` or `core:escalation:<uuid>`.",
          "schema": {
            "type": "string",
            "maxLength": 200
          }
        }
      ],
      "get": {
        "operationId": "getCase",
        "summary": "Read one case as its decision card",
        "description": "Organization API key with decision:read. The card comes from the case's owner.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "view",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "card",
                "business-central",
                "assistant"
              ],
              "default": "card"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The decision card (decionis.delivery.card/1) plus can_decide, in the requested view.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/cases/{caseId}/decisions": {
      "parameters": [
        {
          "name": "caseId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "maxLength": 200
          }
        }
      ],
      "post": {
        "operationId": "decideCase",
        "summary": "Decide a case (the one inbound decision path)",
        "description": "Every channel resolves here, through DecisionActionResolver. Teams and Slack callbacks, the Business Central extension and the `decionis.cases.*` MCP tools all reach the same steps. The channel identity must belong to the workspace's tenant, resolve to a current Accounts member and hold the case's authority. When the authority requirement asks, Presence must have approved the person's passkey first (428 with `step_up_url`). The transition happens at the case's owner, with a revision check, and is applied once per case revision whichever inbox it came from. Organization API key with decision:write and a person (Business Central `x-decionis-actor` or an MCP OAuth token), or the named recipient's own Account session with the signed email `link`.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "view",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "card",
                "business-central",
                "assistant"
              ],
              "default": "card"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "verb",
                  "revision"
                ],
                "properties": {
                  "verb": {
                    "type": "string",
                    "enum": [
                      "approve",
                      "reject",
                      "edit",
                      "escalate"
                    ]
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "decision_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "choices": {
                    "type": "array",
                    "maxItems": 16,
                    "items": {
                      "type": "string"
                    }
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "link": {
                    "type": "string",
                    "description": "Signed email fallback link",
                    "for the email channel only.": null
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`applied` is false when the same decision was already applied (from this or another inbox).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "applied",
                    "card"
                  ],
                  "properties": {
                    "applied": {
                      "type": "boolean"
                    },
                    "card": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "description": "wrong_tenant, not_a_member, not_authorized, actor_required or link_not_yours.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "stale_revision (with the current card), already_decided, decision_in_progress or step_up_unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "410": {
            "description": "case_expired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "428": {
            "description": "step_up_required, with `step_up_url` (the Presence passkey hand-off).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/deliveries": {
      "post": {
        "operationId": "createDelivery",
        "summary": "Hand a case to delivery (internal)",
        "description": "Internal. A producer (Commerce) authenticates with its producer token (`DECIONIS_DELIVERY_PRODUCERS_JSON`) and may only deliver cases of the owners it holds. Core looks recipients up through Accounts, delivers in channel order (Business Central in-app, Teams, Slack, the assistant; email only notifies, or carries a signed link when the person has no other channel), deduplicates by content key and retries in the worker. 503 delivery_disabled while `DECIONIS_DELIVERY_ENABLED` is not 1.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "version",
                  "kind",
                  "org_id",
                  "content_key",
                  "audience"
                ],
                "description": "A case (`card`, decionis.delivery.card/1) or a report artifact (`artifact`) in the producer's own namespace, delivered as an informational card with no verbs.",
                "properties": {
                  "version": {
                    "type": "string",
                    "enum": [
                      "decionis.delivery.item/1"
                    ]
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "case",
                      "artifact"
                    ]
                  },
                  "org_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "content_key": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "card": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "decionis.delivery.card/1"
                  },
                  "audience": {
                    "type": "object",
                    "properties": {
                      "account_user_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "roles": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "recipient_roles": {
                        "type": "array",
                        "maxItems": 3,
                        "items": {
                          "type": "string",
                          "enum": [
                            "finance",
                            "auditor",
                            "signatory"
                          ]
                        }
                      }
                    }
                  },
                  "artifact": {
                    "type": "object",
                    "required": [
                      "type",
                      "id",
                      "title",
                      "url"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "pattern": "^(core|commerce)\\.[a-z][a-z0-9.]{1,60}$"
                      },
                      "id": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "title": {
                        "type": "string",
                        "maxLength": 160
                      },
                      "url": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2048
                      },
                      "period": {
                        "type": "string",
                        "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                      },
                      "verification": {
                        "type": "string",
                        "enum": [
                          "signed",
                          "unsigned"
                        ]
                      },
                      "lines": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "string",
                          "maxLength": 240
                        }
                      },
                      "facts": {
                        "type": "array",
                        "maxItems": 12,
                        "items": {
                          "type": "object",
                          "required": [
                            "label",
                            "value"
                          ],
                          "properties": {
                            "label": {
                              "type": "string",
                              "maxLength": 60
                            },
                            "value": {
                              "type": "string",
                              "maxLength": 240
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted; `duplicate` is true for a content key already delivered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/deliveries/{deliveryId}": {
      "parameters": [
        {
          "name": "deliveryId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getDelivery",
        "summary": "Read a delivery and its receipts (internal)",
        "description": "Internal; the producer that created the delivery, with its producer token.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The delivery and one receipt per channel copy (status, sent and refreshed revision).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/assessments/{assessmentId}/findings": {
      "parameters": [
        {
          "name": "assessmentId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "submitAssessmentFindings",
        "summary": "Submit assessment findings for Core to validate and sign",
        "description": "Organization API key with decision:write (role MEMBER or higher); the organization comes from the key. Core checks record digests, as-of provenance, assessed and total counts, coverage and partial status, and transaction-time amounts in each record's own currency, recomputes the per-currency totals and signs the artifact (decionis.assessments.findings/1) with the dossier Ed25519 key, verifiable offline against /.well-known/decision-dossier-jwks.json. Without a signing key the artifact is stored and labelled unsigned. A partial assessment stays partial. An identical resubmission returns the artifact signed the first time (200).",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssessmentFindingsSubmission"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The artifact already signed for this exact submission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedAssessmentFindings"
                }
              }
            }
          },
          "201": {
            "description": "Signed (or explicitly unsigned) findings artifact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedAssessmentFindings"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listAssessmentFindings",
        "summary": "Read the signed findings of an assessment",
        "description": "Organization API key with decision:read. Returns every findings artifact signed for the assessment in this organization, each verifiable offline.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Signed findings artifacts for the assessment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "version",
                    "assessment_id",
                    "items"
                  ],
                  "properties": {
                    "version": {
                      "type": "string",
                      "const": "decionis.assessments.findings/1"
                    },
                    "assessment_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SignedAssessmentFindings"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/assessments/{assessmentId}/records": {
      "parameters": [
        {
          "name": "assessmentId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "submitAssessmentRecords",
        "summary": "Submit transaction, event or audit records for PolicyAgent to author a policy from",
        "description": "The central policy intake for producers holding an organization key (Commerce, the AgentSafe CLI), with decision:write and role MEMBER or higher; the organization comes from the key. Records arrive inline or as one JSON Lines file (decionis.assessments.records/1). Core's assessor for the domain finds the exposures with the production evaluator (commerce today; cards and agents are refused until their assessors exist), reports missing history as a coverage gap, and signs the findings (decionis.assessments.findings/1) like any submitted findings. New findings reach the managed desk, who propose the policy. Identical records return the findings signed the first time (200).",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssessmentRecords"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The findings already signed for these exact records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssessmentRecordsResult"
                }
              }
            }
          },
          "201": {
            "description": "Signed findings from the records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssessmentRecordsResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/agreements": {
      "post": {
        "operationId": "createOutcomeAgreement",
        "summary": "Draft an outcome agreement",
        "description": "Organization API key with decision:write and role ADMIN or higher; the organization comes from the key. Drafts the agreed outcome meter (decionis.outcomes.agreement/1): workflow, primary metric, scope, baseline, currency and conversion, deductions, who confirms a problem, exclusions, attribution window, monthly close and commercial basis. The agreement becomes ACTIVE only after Decionis signs it with the dossier key and a customer signatory co-signs with a passkey in the delivered case. 503 outcomes_disabled while `DECIONIS_OUTCOMES_ENABLED` is not 1.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutcomeAgreementCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The DRAFT agreement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutcomeAgreementRecord"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/agreements/{agreementId}": {
      "parameters": [
        {
          "name": "agreementId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getOutcomeAgreement",
        "summary": "Read an outcome agreement",
        "description": "Organization API key with decision:read and role VIEWER or higher. Returns the agreement, its state and both signatures; an agreement of another organization is not found.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The agreement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutcomeAgreementRecord"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/agreements/{agreementId}/signatures": {
      "parameters": [
        {
          "name": "agreementId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "signOutcomeAgreement",
        "summary": "Sign an outcome agreement for Decionis (platform)",
        "description": "Platform credential only. Signs the exact artifact digest with the dossier Ed25519 key (verifiable offline against /.well-known/decision-dossier-jwks.json), opens a Presence passkey request bound to the agreement for a customer signatory (OWNER, ADMIN or an Accounts signatory designation) and delivers the signing case in Business Central, Teams, Slack or the assistant. The customer co-signs there, through POST /v1/cases/{caseId}/decisions, never through this API. Without a signing key it answers 503 outcome_signing_unavailable.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutcomeAgreementSignatureRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The agreement, AWAITING_CUSTOMER.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutcomeAgreementRecord"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/agreements/{agreementId}/statements": {
      "parameters": [
        {
          "name": "agreementId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "closeOutcomeStatement",
        "summary": "Close a month into a signed outcome statement (platform)",
        "description": "Platform credential only; the worker closes due months daily. Refuses a period whose close-out days have not passed (409 outcome_period_open). Classifies the latest evidence revision of every subject with the agreement's calculator: PREVENTED only when a person confirmed the problem and the action was never paid; held-unconfirmed amounts are exposure, shadow estimates are never summed with realized results, and changes to earlier months are appended as corrections. Net benefit is null when any currency is unconverted. Signs the statement (decionis.outcomes.statement/1) or labels it unsigned, and sends finance and auditor recipients an informational card (email only notifies). Closing a closed month returns the statement signed the first time (200).",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "period"
                ],
                "additionalProperties": false,
                "properties": {
                  "period": {
                    "type": "string",
                    "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The statement already closed for the month.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedOutcomeStatement"
                }
              }
            }
          },
          "201": {
            "description": "The statement for the month.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedOutcomeStatement"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/statements": {
      "get": {
        "operationId": "listOutcomeStatements",
        "summary": "List signed outcome statements",
        "description": "Organization API key with decision:read and role VIEWER or higher. Every statement of the key's organization, optionally for one month, each verifiable offline with `decionis-verify outcomes`.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The statements.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "statements"
                  ],
                  "properties": {
                    "statements": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SignedOutcomeStatement"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/statements/{statementId}": {
      "parameters": [
        {
          "name": "statementId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getOutcomeStatement",
        "summary": "Read one signed outcome statement",
        "description": "Organization API key with decision:read and role VIEWER or higher.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The statement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedOutcomeStatement"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/evidence": {
      "post": {
        "operationId": "submitOutcomeEvidence",
        "summary": "Submit outcome evidence (internal producers)",
        "description": "Internal. Only a producer whose token (`DECIONIS_DELIVERY_PRODUCERS_JSON`) carries the matching `outcomes` capability (commerce or agentsafe) may submit; an organization key can never feed the meter. Up to 1,000 subjects per batch (decionis.outcomes.submission/1, contract packages/shared/contracts/OutcomeEvidence.v1.json), each a digest-only record of the decision, review, execution and financial result. Revisions are append-only: the same subject and revision with different content is 409 evidence_revision_conflict.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutcomeEvidenceSubmission"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and duplicate counts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "accepted",
                    "duplicates"
                  ],
                  "properties": {
                    "accepted": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "duplicates": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/statements/{statementId}/charge": {
      "parameters": [
        {
          "name": "statementId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getOutcomeStatementCharge",
        "summary": "Read the outcome fee charged for a statement",
        "description": "Organization API key with decision:read and role VIEWER or higher. The signed monthly fee (decionis.outcomes.charge/1) Decionis computed from this statement and the agreement's commercial terms (a share of the net benefit or a fee on governed value, raised to the floor and limited by the cap), with the marketplace receipt once it was billed. 404 when the agreement charges nothing, the agreement is a sandbox, or the statement is unsigned.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The charge and its receipt (null until billed).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "charge",
                    "receipt"
                  ],
                  "properties": {
                    "charge": {
                      "$ref": "#/components/schemas/SignedOutcomeCharge"
                    },
                    "receipt": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/OutcomeChargeReceipt"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/reports/drift": {
      "get": {
        "operationId": "listOutcomeDriftReports",
        "summary": "List signed monthly drift reports",
        "description": "Organization API key with decision:read and role VIEWER or higher. Every drift report of the key's organization (decionis.outcomes.drift/1), optionally for one month: policy releases and activations with their approvals and governance profile, SHADOW and PARALLEL verdicts that disagreed with what was enforced (counts by decision type and verdict, never money), and writes that passed without a binding decision. Every number comes from records; a source Core does not hold is listed as not_reported, never as zero. Closed monthly with the statements, signed with the dossier key or labelled unsigned, and verifiable offline with `decionis-verify outcomes`. 503 outcomes_disabled while the meter is off.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The drift reports.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "reports"
                  ],
                  "properties": {
                    "reports": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SignedOutcomeDriftReport"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/reports/drift/{reportId}": {
      "parameters": [
        {
          "name": "reportId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getOutcomeDriftReport",
        "summary": "Read one signed monthly drift report",
        "description": "Organization API key with decision:read and role VIEWER or higher.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The drift report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedOutcomeDriftReport"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/disputes": {
      "post": {
        "operationId": "openOutcomeDispute",
        "summary": "Dispute an outcome subject",
        "description": "Organization API key with decision:write and role ADMIN or higher. While the dispute is open, or once it is upheld, the subject counts as disputed in every statement and in no charge. A dispute opened after a month closed reaches the next statement as a correction. One open dispute per subject (409 outcome_dispute_open); a subject the meter has never seen is 404.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "subject_digest",
                  "reason"
                ],
                "additionalProperties": false,
                "properties": {
                  "subject_digest": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The open dispute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutcomeDispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listOutcomeDisputes",
        "summary": "List outcome disputes",
        "description": "Organization API key with decision:read and role VIEWER or higher.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "resolved",
                "all"
              ],
              "default": "all"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The disputes, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "disputes"
                  ],
                  "properties": {
                    "disputes": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OutcomeDispute"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/disputes/{disputeId}/resolutions": {
      "parameters": [
        {
          "name": "disputeId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "resolveOutcomeDispute",
        "summary": "Resolve an outcome dispute (platform)",
        "description": "Platform credential only. UPHELD keeps the subject out of statements and charges for good; REJECTED lets it count again, through a correction in the next statement. A dispute is resolved once (409 outcome_dispute_resolved).",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "resolution"
                ],
                "additionalProperties": false,
                "properties": {
                  "resolution": {
                    "type": "string",
                    "enum": [
                      "UPHELD",
                      "REJECTED"
                    ]
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The resolved dispute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutcomeDispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/charges": {
      "get": {
        "operationId": "listOutcomeCharges",
        "summary": "List an organization's outcome charges (internal producers)",
        "description": "Internal. The producer that bills a platform subscription (Commerce) reads the charges of one organization with its producer token, which must carry the outcomes capability. status=unbilled (the default) returns only charges with no receipt. Contract: packages/shared/contracts/OutcomeCharge.v1.json.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unbilled",
                "all"
              ],
              "default": "unbilled"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Charges, oldest month first, each with its receipt or null.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "charges"
                  ],
                  "properties": {
                    "charges": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "charge",
                          "receipt"
                        ],
                        "properties": {
                          "charge": {
                            "$ref": "#/components/schemas/SignedOutcomeCharge"
                          },
                          "receipt": {
                            "oneOf": [
                              {
                                "$ref": "#/components/schemas/OutcomeChargeReceipt"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/charges/{chargeId}": {
      "parameters": [
        {
          "name": "chargeId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getOutcomeCharge",
        "summary": "Read one outcome charge (internal producers)",
        "description": "Internal; the billing producer's token with the outcomes capability.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The charge and its receipt or null.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "charge",
                    "receipt"
                  ],
                  "properties": {
                    "charge": {
                      "$ref": "#/components/schemas/SignedOutcomeCharge"
                    },
                    "receipt": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/OutcomeChargeReceipt"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/outcomes/charges/{chargeId}/receipts": {
      "parameters": [
        {
          "name": "chargeId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "recordOutcomeChargeReceipt",
        "summary": "Record the marketplace receipt for a charge (internal producers)",
        "description": "Internal. After billing the charge's outcome dimension on Microsoft or AWS Marketplace, the producer records the one receipt (decionis.outcomes.receipt/1). The identical receipt again answers 200; any other receipt for the same charge is 409 charge_already_billed, so a charge is never billed twice.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutcomeChargeReceipt"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The identical receipt was already recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutcomeChargeReceipt"
                }
              }
            }
          },
          "201": {
            "description": "Recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutcomeChargeReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/internal/platforms/microsoft/organizations": {
      "post": {
        "operationId": "provisionMicrosoftPlatformOrganization",
        "summary": "Create the organization of a Microsoft platform purchase (internal producers)",
        "description": "Internal; default off (503 platform_workspaces_disabled until `DECIONIS_PLATFORM_WORKSPACES_ENABLED` is 1). Only a producer whose token (`DECIONIS_DELIVERY_PRODUCERS_JSON`) carries `platforms: [\"microsoft\"]` may call it: no token or an unknown one is 401 producer_required, any other producer 403 platform_not_allowed, and an organization key is never accepted. Commerce passes the workspace mapping Accounts signed for a `decionis-platform` purchase, with its evidence, verbatim. Core checks the version, platform, product and environment (400 otherwise); that the Accounts organization and workspace ids derive from source_org_id, that issued_at is within the last 10 minutes, and the Ed25519 signature over the canonical (sorted-key) mapping against the current Accounts JWKS (422 accounts_evidence_invalid with reason ids, stale or signature; 503 accounts_evidence_unavailable while the JWKS is unreachable). In one transaction it creates the organization with id = source_org_id, no Core owner, source product decionis and the production environment, its default entitlement, and the synchronized Accounts workspace reference, so the buyer's later Decionis sign-in to that workspace lands in this organization. The same reference again is 200 replayed; an existing organization with any other reference, a workspace already bound elsewhere, or an organization created for another subscription is 409 organization_conflict. No person, session or key is created. The optional `subscription` is the subscription's current state from Commerce's lifecycle, outside the signature: its paid plan becomes the organization's entitlement in the same transaction (422 plan_unknown for a plan code Core does not sell, before any write), and the answer reports what it did as `subscription`. Without it the organization gets the default entitlement.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MicrosoftPlatformOrganizationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The organization already holds this Accounts reference.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MicrosoftPlatformOrganization"
                }
              }
            }
          },
          "201": {
            "description": "Provisioned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MicrosoftPlatformOrganization"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/internal/platforms/microsoft/organizations/{orgId}/subscriptions/{subscriptionId}": {
      "parameters": [
        {
          "name": "orgId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          }
        },
        {
          "name": "subscriptionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          }
        }
      ],
      "put": {
        "operationId": "putMicrosoftPlatformSubscription",
        "summary": "Apply a Microsoft platform subscription's state to its organization (internal producers)",
        "description": "Internal; default off, with the same flag and producer capability as provisionMicrosoftPlatformOrganization. Commerce sends each state its Microsoft lifecycle records for the subscription (plan change, Suspend, Reinstate, Unsubscribe), numbered by `revision`. Only the subscription the organization was created for is accepted. A higher revision applies: SUBSCRIBED grants the plan; SUSPENDED and UNSUBSCRIBED keep the plan with API access off, so decisions answer 402 until Reinstate. The same revision with the same state is `replayed`, an older one `stale`; neither changes anything. The organization's entitlement moves only while it is the default or this source's own (`marketplace:microsoft:platform`); otherwise the state is recorded and `projected` is false. 404 subscription_not_found when Core created no organization for this subscription; 409 subscription_conflict with reason subscription (another subscription), revision (the same revision with another state) or ended (a change after UNSUBSCRIBED); 422 plan_unknown for a plan code Core does not sell.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MicrosoftPlatformSubscriptionState"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Applied, replayed or stale.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MicrosoftPlatformSubscription"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/decisions/{decisionId}/explanation": {
      "parameters": [
        {
          "name": "decisionId",
          "in": "path",
          "required": true,
          "description": "A protocol decision evaluation id in the key's organization.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getDecisionExplanation",
        "summary": "Explain a held decision in customer-safe words",
        "description": "Organization API key with decision:read and role VIEWER or higher; the organization comes from the key. For a HOLD, BLOCK or ESCALATE decision, returns wording a support agent can pass on (no codes, check ids or figures) and an internal part with reason codes, check ids and the dossier id. An approved decision is 409 decision_not_held.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The explanation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionExplanation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/commerce/payments/history": {
      "get": {
        "operationId": "readCommercePaymentHistory",
        "summary": "Read posted Business Central payment history for an assessment",
        "description": "Default off with the native Business Central reader. Ordinary workspace key with decision:read and decision:write and current native READ authority. Reads the fixed read-only pages for posted vendor payments, vendor invoices and their applications, and the Change Log's vendor bank-account entries, for a window of at most 92 days. Identifiers are company-scoped SHA-256 digests; bank numbers and business identifiers never leave Core. When the Change Log is off or does not log vendor bank accounts, bank_changes.available is false and coverage is incomplete; no change history is inferred. Nothing is written.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connection_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "revision",
            "in": "query",
            "required": true,
            "description": "The connection revision the caller expects.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Exclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Posted history and its coverage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentHistory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/commerce/sales/history": {
      "get": {
        "operationId": "readCommerceSalesHistory",
        "summary": "Read Business Central sales history for reconciliation",
        "description": "Default off with the native Business Central reader. Ordinary workspace key with decision:read and decision:write and current native READ authority. Reads the extension's fixed read-only sales pages (1.0.2.4) for open sales orders by Order Date and posted sales invoices by Posting Date, for a window of at most 92 days. Identifiers are company-scoped SHA-256 digests; document numbers, order numbers and External Document No. never leave Core. The External Document No. is digested exactly as Business Central stores it. Amounts exclude tax, in integer minor units of the document currency. A read capped at 4,000 orders or 8,000 invoices sets coverage.truncated with a reason. When the connected extension does not publish a page (older than 1.0.2.4), that list is empty and coverage is incomplete with SALES_ORDER_PAGE_NOT_INSTALLED or SALES_INVOICE_PAGE_NOT_INSTALLED; no sale is inferred. A negative document is left out with NEGATIVE_SALES_DOCUMENTS_EXCLUDED. Nothing is written.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connection_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "revision",
            "in": "query",
            "required": true,
            "description": "The connection revision the caller expects.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Exclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sales documents as digests and their coverage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceSalesHistory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/policies/{policyId}/records": {
      "parameters": [
        {
          "name": "policyId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "uploadPolicyRecords",
        "summary": "Upload transaction, event or audit records to a policy",
        "description": "The owner's door into the central policy intake. Account session of the policy's POLICY_OWNER or SOURCE_CUSTODIAN; same-site JSON and an Idempotency-Key are required. The records are assessed and signed exactly as on /v1/assessments/{assessmentId}/records, and the upload is recorded on the policy's access chain. The findings stay with this policy, and its authors (the desk on a MANAGED policy) receive the findings case. Uploading changes no revision, so the uploader never becomes an author. A policy_id in the body must name this policy.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssessmentRecords"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The findings already signed for these exact records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssessmentRecordsResult"
                }
              }
            }
          },
          "201": {
            "description": "Signed findings from the records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssessmentRecordsResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/policies/{policyId}/proposals": {
      "parameters": [
        {
          "name": "policyId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listPolicyProposals",
        "summary": "List a policy's proposals",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Proposal run metadata, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createPolicyProposal",
        "summary": "Propose a policy from signed findings or governed documents",
        "description": "Account session of a policy AUTHOR or POLICY_OWNER; same-site JSON and an Idempotency-Key are required. With findingsIds, a deterministic parameter proposer sets commerce-preflight-v2 parameters (P01, P09, P12, P13, P14, P15, P16) from the findings' distributions; every parameter cites the findings behind it and the same findings always produce the same parameters. An approved model, when named, writes only the rationale. With sourceIds, the existing document drafting runs. Alias kept on the same handler /v1/public/account/workspace/policy-platform/{policyId}/proposals.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PolicyFindingsDraftRequest"
                  },
                  {
                    "$ref": "#/components/schemas/PolicyDocumentDraftRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The proposal run. A findings proposal is READY or HELD immediately.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "policy",
                    "run"
                  ],
                  "properties": {
                    "policy": {
                      "type": "object"
                    },
                    "run": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/policies/{policyId}/proposals/{proposalId}": {
      "parameters": [
        {
          "name": "policyId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "proposalId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getPolicyProposal",
        "summary": "Read a proposal, its candidate revision, findings and cited evidence",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Run metadata and result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "run",
                    "result"
                  ],
                  "properties": {
                    "run": {
                      "type": "object"
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/policies/{policyId}/proposals/{proposalId}/decisions": {
      "parameters": [
        {
          "name": "policyId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "proposalId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "decidePolicyProposal",
        "summary": "Accept, split or reject a proposal",
        "description": "Account session of a policy AUTHOR or POLICY_OWNER; same-site JSON and an Idempotency-Key are required. ACCEPT saves the candidate as a new DRAFT revision; for a findings proposal SPLIT accepts only the named checks (ruleIds such as [\"P14\"]) and returns the others to their previous values. The existing review, assurance and shadow gates carry the revision to APPROVED_FOR_SHADOW; nothing here reaches production. Alias kept on the same handler /v1/public/account/workspace/policy-platform/{policyId}/proposals/{proposalId}/decisions.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyProposalDecision"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The policy document after the decision.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/policies/{policyId}/proposals/{proposalId}/replays": {
      "parameters": [
        {
          "name": "policyId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "proposalId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "replayPolicyProposal",
        "summary": "Replay current against proposed on the assessed records",
        "description": "Account session with READ access; same-site JSON and an Idempotency-Key are required. Both configurations are evaluated by the production commerce-preflight evaluator on identical records at their transaction time, scoped to the checks the proposal changes. Money is totalled by finding category in each transaction currency without conversion, false holds (held records with no exposure finding) are counted, and caps and coverage are explicit. Nothing is stored, sent or executed.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyProposalReplay"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/public/account/workspace/policy-platform/{policyId}/proposals": {
      "post": {
        "operationId": "createPolicyProposalAlias",
        "summary": "Deprecated alias of POST /v1/policies/{policyId}/proposals",
        "deprecated": true,
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "policyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PolicyFindingsDraftRequest"
                  },
                  {
                    "$ref": "#/components/schemas/PolicyDocumentDraftRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Same handler and response as the canonical path."
          }
        }
      }
    },
    "/v1/public/account/workspace/policy-platform/{policyId}/proposals/{proposalId}/decisions": {
      "post": {
        "operationId": "decidePolicyProposalAlias",
        "summary": "Deprecated alias of POST /v1/policies/{policyId}/proposals/{proposalId}/decisions",
        "deprecated": true,
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "policyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyProposalDecision"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Same handler and response as the canonical path."
          }
        }
      }
    },
    "/v1/public/account/workspace/policy-platform/invariants": {
      "get": {
        "operationId": "listPolicyInvariants",
        "summary": "List the organisation's policy invariants, live and retired",
        "description": "Account session of any workspace member. Every declaration the organisation's owner made for the environment, newest first, each with its digest and, once retired, its retirement.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "sandbox",
                "production"
              ],
              "default": "sandbox"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The declarations.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "invariants"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "invariants": {
                      "type": "array",
                      "maxItems": 500,
                      "items": {
                        "$ref": "#/components/schemas/PolicyInvariantEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "declarePolicyInvariant",
        "summary": "Declare an organisation invariant every policy release in its scope must refuse",
        "description": "Account session of the organisation's owner only (`POLICY_INVARIANT_OWNER_REQUIRED`); same-site JSON and an Idempotency-Key are required. The invariant compiles to one scenario per combination of its varied values, each a copy of `input` with `decision_type` set to the invariant's. From the next assurance run on, every candidate of every policy whose runtime scope names the invariant's decision domain and type (or that declares no scope) must REJECT each compiled scenario, or the run fails with `INVARIANT_VIOLATED`; no dataset disposition, review or approval clears it. One live declaration per invariant id (`409 POLICY_INVARIANT_ALREADY_DECLARED`); the live set compiles to at most 500 scenarios per environment (`422 POLICY_INVARIANT_LIMIT`).",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "environment",
                  "invariant",
                  "reason"
                ],
                "additionalProperties": false,
                "properties": {
                  "environment": {
                    "type": "string",
                    "enum": [
                      "sandbox",
                      "production"
                    ]
                  },
                  "invariant": {
                    "$ref": "#/components/schemas/PolicyInvariant"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The declaration, as evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyInvariantEntry"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/public/account/workspace/policy-platform/invariants/{invariantId}/retirements": {
      "post": {
        "operationId": "retirePolicyInvariant",
        "summary": "Retire an organisation invariant, naming the exact declaration it ends",
        "description": "Account session of the organisation's owner only; same-site JSON and an Idempotency-Key are required. `invariantDigest` must be the live declaration's digest (`409 POLICY_INVARIANT_DIGEST_MISMATCH`); a declaration is retired once (`409 POLICY_INVARIANT_ALREADY_RETIRED`). The declaration itself never changes; the retirement is recorded beside it, and the next assurance run no longer reads it.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "invariantId",
            "in": "path",
            "required": true,
            "description": "The declaration's id (`record.id`), not the invariant's name.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "environment",
                  "invariantDigest",
                  "reason"
                ],
                "additionalProperties": false,
                "properties": {
                  "environment": {
                    "type": "string",
                    "enum": [
                      "sandbox",
                      "production"
                    ]
                  },
                  "invariantDigest": {
                    "type": "string",
                    "pattern": "^sha256:[a-f0-9]{64}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The declaration with its retirement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyInvariantEntry"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/policies/bundles": {
      "post": {
        "operationId": "encodePolicyBundle",
        "summary": "Submit a versioned policy bundle artifact for Decionis encoding",
        "description": "Use this endpoint only when an integration participates in policy\nauthoring. The SDK submits a reviewed policy bundle artifact to\nDecionis; it does not evaluate or enforce policy rules locally.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CorrelationId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyBundle"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Policy bundle accepted for encoding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactAcceptedResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/signals/envelopes": {
      "post": {
        "operationId": "ingestProtocolSignalEnvelope",
        "summary": "Ingest a versioned Protocol signal envelope",
        "description": "Persists an evidence-bearing signal for deterministic policy evaluation\nand material-signal revalidation. Semantic classifier metadata is input\nevidence only and cannot mint an authority verdict or execution grant.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CorrelationId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProtocolSignalEnvelope"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Signal envelope accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactAcceptedResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/orgs/{org_id}/policies/strategies/draft": {
      "post": {
        "operationId": "draftPolicyStrategy",
        "summary": "Draft a reviewable policy strategy from unstructured sources",
        "description": "Turns scattered policy material — pasted text and uploaded files\n(PDF, XLSX, XML, HTML, JSON, plain text such as transaction or audit\nlogs) plus optional live policy-source connectors (Jira, Confluence,\nNotion, Google Drive, Git repository, SAP) — into a strategy-shaped\nDecionis draft with clauses bucketed for automatic execution,\nescalation, and blocking. The draft is not persisted: review it, then\nencode the accepted version. Drafting is LLM-assisted when a provider\nis configured and falls back to deterministic extraction otherwise;\n`used_llm` reports which path ran. Requires an org API key with the\nADMIN role and the `autonomous:manage` or `org:*` scope.\n",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/CorrelationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyDraftRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Non-persistent policy strategy draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyStrategyDraftResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/orgs/{org_id}/policies/packs/draft": {
      "post": {
        "operationId": "draftPolicyPack",
        "summary": "Draft an executable policy pack from unstructured sources",
        "description": "Same inputs as the strategy draft, but the output is the executable\nDecionis policy pack — `{ name, all|any: [{field, op, value}], action }`\nrules. Every synthesized rule is validated through the rules compiler\nbefore it is returned; anything that cannot become an executable\npredicate is returned under `review`, never as a broken rule. The\ndraft is persisted for the org (`pack_id`) so it can be reviewed,\nedited, and finalized. Requires an org API key with the ADMIN role\nand the `autonomous:manage` or `org:*` scope.\n",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/CorrelationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyDraftRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Persisted executable policy pack draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyPackDraftResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/shadow/evaluate-decision/reports": {
      "get": {
        "operationId": "listShadowEvaluateDecisionReports",
        "summary": "List shadow-mode decision evaluation reports",
        "description": "Returns protocol-owned shadow reports derived from saved\nevaluate-decision records. Reports summarize what Decionis would\ncontinue, stop, hand off, or review without exposing policy rules.\n",
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SHADOW",
                "PARALLEL",
                "ENFORCEMENT"
              ],
              "default": "SHADOW"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 50
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Shadow report list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShadowEvaluateDecisionReportsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/shadow/evaluate-decision/reports/summary": {
      "get": {
        "operationId": "summarizeShadowEvaluateDecisionReports",
        "summary": "Summarize shadow-mode decision evaluation reports",
        "description": "Returns aggregate protocol-owned shadow report metrics for saved\nevaluate-decision records.\n",
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SHADOW",
                "PARALLEL",
                "ENFORCEMENT"
              ],
              "default": "SHADOW"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 50
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Shadow report summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShadowEvaluateDecisionReportsSummaryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/analytics/events": {
      "post": {
        "operationId": "recordAnalyticsEvent",
        "summary": "Ingest a public experiment analytics event",
        "description": "Public sink for proof-led A/B exposure and conversion events. Events are\nidempotent on visitor_id, experiment, event, and occurred_at.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyticsEventRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Analytics event accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "accepted",
                    "event_id",
                    "idempotent_replay",
                    "experiment",
                    "variant",
                    "report"
                  ],
                  "properties": {
                    "accepted": {
                      "type": "boolean"
                    },
                    "event_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "idempotent_replay": {
                      "type": "boolean"
                    },
                    "experiment": {
                      "type": "string"
                    },
                    "variant": {
                      "type": "string",
                      "enum": [
                        "A",
                        "B"
                      ]
                    },
                    "report": {
                      "$ref": "#/components/schemas/AnalyticsExperimentReport"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/analytics/experiments/{experiment}/report": {
      "get": {
        "operationId": "getAnalyticsExperimentReport",
        "summary": "Report exposure-to-conversion rates for an experiment",
        "parameters": [
          {
            "name": "experiment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365,
              "default": 90
            }
          },
          {
            "name": "conversion_event",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Experiment conversion report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsExperimentReport"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/compliance/evidence-pack": {
      "post": {
        "operationId": "createComplianceEvidencePack",
        "summary": "Generate and persist a signed compliance evidence pack",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComplianceEvidencePackRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Signed evidence pack",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComplianceEvidencePackResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/verify/evidence/{pack_id}": {
      "get": {
        "operationId": "verifyComplianceEvidencePack",
        "summary": "Publicly verify a signed compliance evidence pack",
        "security": [],
        "parameters": [
          {
            "name": "pack_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Evidence pack verification result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidencePackVerificationResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/public/agents/provision": {
      "post": {
        "operationId": "provisionAnonymousAgentWorkspace",
        "summary": "Mint a provisional anonymous workspace and API key",
        "security": [],
        "description": "Zero-human onboarding entry point. Mints a provisional workspace, its\norg API key, and a seeded shadow-mode default policy — no account, no\nemail. Hard caps: 10 requests per minute, 5 provisional workspaces per\nnetwork per 24 hours, and an exploration allowance of 50 governed\ndecisions per month. The raw key is returned exactly once. Every\ndossier a provisional workspace mints carries a SIGNED issuer_context\ntier of \"provisional_anonymous\" inside the dossier claims, so a\nverifier can always distinguish it from an owned org's dossier.\nClaiming (POST /v1/orgs/{org_id}/claim/start then /claim/verify)\nattaches a human owner; the key and the dossier ledger survive the\nclaim.\nThe workspace is stamped with what the caller's User-Agent says about\nwhere it came from and nothing else: the product and version, and\nfor the open-source runtime's `agent-safe-pipeline/<version>\n(repo=<owner/name>; example=<name>; surface=github)` form and\nGovern's `govern/<version> (example=govern@<version>;\nsurface=<runner>; repo=<owner/name>)` form, the repository, example\nand surface. The stamp is accounting for the acquisition funnel; it\nis never decision input and never verified.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentProvisionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Provisional workspace minted; the raw key appears only here",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentProvisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/public/decision-dossiers/{dossier_id}/verify": {
      "get": {
        "operationId": "verifyPublicDecisionDossier",
        "summary": "Verify a Decision Dossier — no account required",
        "security": [],
        "description": "Runs the real Ed25519 verification against the published public JWKS —\nthe same check anyone can reproduce offline with @decionis/verify —\nand returns a share-safe, masked projection of the dossier. The ?sig\ncapability comes from a dossier's verification envelope and only gates\naccess (it keeps dossier ids from being enumerated); the signatures\nprove authenticity. Every capability failure collapses to the same\n404 — no oracle about which check failed.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicDossierId"
          },
          {
            "$ref": "#/components/parameters/ShareLinkSignature"
          },
          {
            "$ref": "#/components/parameters/ShareLinkExpiry"
          }
        ],
        "responses": {
          "200": {
            "description": "Verification result with a masked public dossier projection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicDossierVerificationResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/public/decision-dossiers/{dossier_id}/proof-bundle": {
      "get": {
        "operationId": "getPublicDecisionDossierProofBundle",
        "summary": "Fetch the signed documents and Ed25519 proof bundle",
        "security": [],
        "description": "Returns only what independent verification needs: the signed documents\nat their JSON-pointer paths, the Ed25519 proof bundle, and the public\nJWKS URL. Same ?sig share-link capability as /verify. Verify offline\nwith `npx @decionis/verify \"<this URL>\"`. Exit 0 means the presented\nproof artifacts are cryptographically valid; it does not by itself\nestablish current execution eligibility.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicDossierId"
          },
          {
            "$ref": "#/components/parameters/ShareLinkSignature"
          },
          {
            "$ref": "#/components/parameters/ShareLinkExpiry"
          }
        ],
        "responses": {
          "200": {
            "description": "Signed documents plus the proof bundle and JWKS pointer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicDossierProofBundleResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/public/decision-dossiers/{dossier_id}/reproduce": {
      "get": {
        "operationId": "reproducePublicDecisionDossier",
        "summary": "Deterministically re-run the recorded decision",
        "security": [],
        "description": "Re-runs the recorded inputs through the recorded policy bundle in the\nprotocol engine — side-effect-free, nothing persisted — and reports\nwhether the same verdict comes out. Same ?sig capability as /verify;\nbecause replay actually runs the policy engine, results are cached for\nabout 60 seconds and capped at 20 requests per minute per dossier.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicDossierId"
          },
          {
            "$ref": "#/components/parameters/ShareLinkSignature"
          },
          {
            "$ref": "#/components/parameters/ShareLinkExpiry"
          }
        ],
        "responses": {
          "200": {
            "description": "Reproduction outcome for the recorded decision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicDossierReproduceResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/orgs/{org_id}/claim/start": {
      "post": {
        "operationId": "startOrgClaim",
        "summary": "Start claiming a provisional workspace (email OTP)",
        "description": "First half of attaching a human owner to an anonymously minted\nworkspace. Org-key authed — holding the workspace's key is the\npossession proof that decides who may attach an owner. The org must be\nprovisional and unclaimed. Emails a six-digit OTP with a 5-minute\nexpiry to owner_email; 10 requests per minute.\n",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrgClaimStartRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "OTP challenge created and emailed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgClaimStartResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "description": "Not a provisional workspace (it already has an owner path)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The workspace is already claimed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/orgs/{org_id}/claim/verify": {
      "post": {
        "operationId": "verifyOrgClaim",
        "summary": "Finish claiming a provisional workspace",
        "description": "Second half of the claim: org-key authed, with a timing-safe check of\nthe emailed OTP (3 attempts per challenge). Attaches an existing\naccount by email or creates one — a new account requires a password so\nthe claimed identity can sign back in. The claim is atomic; the API\nkey and every dossier minted before the claim survive. 10 requests per\nminute.\n",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrgClaimVerifyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Workspace claimed; a signed account session cookie is set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgClaimVerifyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "OTP invalid, expired, or attempt cap reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "Already claimed, or the OTP was already used",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/orgs/{org_id}/verification-links/rotate": {
      "post": {
        "operationId": "rotateOrgVerificationLinks",
        "summary": "Revoke every outstanding v2 dossier share link for the org",
        "description": "v2 dossier share links are signed with a per-org derived secret;\nbumping the org's secret version invalidates every v2 link the org has\never minted — one org, one bump, nothing global. Freshly minted links\nuse the new version. Revoking every outstanding share link is an admin\nact: requires an org API key with the ADMIN role. 5 requests per\nminute.\n",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Secret version bumped; all previously issued v2 links are dead",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgVerificationLinkRotationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments": {
      "get": {
        "operationId": "readHostedGatewayDeployment",
        "summary": "Read one of the workspace's hosted gateways and the list of all of them",
        "description": "Account session scoped to the current workspace; reads require membership. The organization comes only from the session. Without deployment_id the answer is the workspace's primary gateway; with it, that gateway, or 404 GATEWAY_NOT_FOUND when the workspace holds no gateway with that id (never the primary). `deployments` lists every gateway the workspace holds and `deployment_limit` the capacity an operator granted it (default 1). Reservation is a name allocation, never evidence of DNS, TLS or runtime readiness.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "responses": {
          "200": {
            "description": "Private overview; credentials appear only as prefixes and status.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeploymentOverview"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST when deployment_id is not a UUID."
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "404": {
            "description": "GATEWAY_NOT_FOUND."
          }
        }
      },
      "post": {
        "operationId": "reserveHostedGatewayDeployment",
        "summary": "Reserve the workspace's first gateway domain, or an additional one",
        "description": "Signed account session, current workspace ADMIN or OWNER; same-site JSON is mandatory. A body with an optional company_name reserves the workspace's primary gateway, or returns it when one exists. A body with additional:true and tenant_label reserves a further gateway at exactly <tenant_label>.decionisedge.com, needs a verified email, and fits within the capacity an operator granted the workspace; repeating it returns the same gateway. The answer is the reserved gateway's overview. Reservation grants no access to a fleet tenant already serving that label.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayDeploymentReservation"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The reserved gateway's overview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeploymentOverview"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST, or GATEWAY_LABEL_INVALID for a malformed or reserved label."
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, ADMIN or OWNER required, or VERIFIED_EMAIL_REQUIRED for an additional gateway."
          },
          "409": {
            "description": "GATEWAY_DEPLOYMENT_LIMIT_REACHED at the workspace's granted capacity, GATEWAY_PRIMARY_REQUIRED before the workspace has its first gateway, or GATEWAY_DOMAIN_UNAVAILABLE when another workspace holds the label."
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED."
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/activate": {
      "post": {
        "operationId": "activateHostedGatewayDeployment",
        "summary": "Approve the upstream origin of one of the workspace's gateways and start its setup",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. Acts on the gateway deployment_id names, else the primary. Records the consent and queues provisioning; ownership proof, keys and readiness follow in the background. An explicit id the workspace does not hold is 404 GATEWAY_NOT_FOUND.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayDeploymentActivation"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The gateway's overview, with provisioning queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeploymentOverview"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST or an origin the hosted gateway cannot front."
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, ADMIN or OWNER required, or VERIFIED_EMAIL_REQUIRED."
          },
          "404": {
            "description": "GATEWAY_NOT_RESERVED without a gateway, or GATEWAY_NOT_FOUND for an id the workspace does not hold."
          },
          "409": {
            "description": "The gateway is being provisioned, or its credential needs reconnection."
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED."
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/mode": {
      "post": {
        "operationId": "setHostedGatewayMode",
        "summary": "Turn enforcement on or off for one of the workspace's gateways",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. Acts on the gateway deployment_id names, else the primary; every gateway has its own mode, upstream credential and named policy. The upstream credential is sealed at once and never logged, echoed or returned. An explicit id the workspace does not hold is 404 GATEWAY_NOT_FOUND.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayModeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Nothing to change; the gateway's overview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeploymentOverview"
                }
              }
            }
          },
          "202": {
            "description": "The change is queued; the gateway's overview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeploymentOverview"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST, UPSTREAM_CREDENTIAL_HEADER_INVALID or UPSTREAM_CREDENTIAL_INVALID."
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, VERIFIED_EMAIL_REQUIRED, HOSTED_GATEWAY_ADMIN_REQUIRED or HOSTED_GATEWAY_ENFORCEMENT_UNAVAILABLE."
          },
          "404": {
            "description": "GATEWAY_NOT_RESERVED without a gateway, or GATEWAY_NOT_FOUND for an id the workspace does not hold."
          },
          "409": {
            "description": "GATEWAY_NOT_READY, UPSTREAM_CREDENTIAL_REQUIRED or a provisioning lease in progress."
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED."
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/credentials/reveal": {
      "post": {
        "operationId": "revealHostedGatewayTenantKey",
        "summary": "Reveal one gateway's ingress (tenant) key, once",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. Acts on the gateway deployment_id names, else the primary. Returns that gateway's AgentSafe-Tenant-Key exactly once, after the fleet verified it; each gateway has its own key. An explicit id the workspace does not hold is 404 GATEWAY_NOT_FOUND.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpEmpty"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tenant key; store it at once in a secret manager.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTenantKey"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, ADMIN or OWNER required, or VERIFIED_EMAIL_REQUIRED."
          },
          "404": {
            "description": "GATEWAY_NOT_FOUND for an id the workspace does not hold."
          },
          "409": {
            "description": "GATEWAY_NOT_READY, GATEWAY_CREDENTIAL_INACTIVE or GATEWAY_KEY_ALREADY_REVEALED."
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED."
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/gateway-token/reveal": {
      "post": {
        "operationId": "revealHostedGatewayToken",
        "summary": "Reveal one gateway's gateway token, once",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. Acts on the gateway deployment_id names, else the primary. Returns the token that gateway sends the tenant's API in AgentSafe-Gateway-Token on every forwarded request, exactly once, after the fleet verified the gateway. Decionis mints it with the tenant key and keeps it sealed for the fleet; a token that was not saved is replaced by regenerating it. sent says whether every pod sends it now. An explicit id the workspace does not hold is 404 GATEWAY_NOT_FOUND.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpEmpty"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The gateway token; store it at once where the tenant's API reads it.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayToken"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, ADMIN or OWNER required, or VERIFIED_EMAIL_REQUIRED."
          },
          "404": {
            "description": "GATEWAY_NOT_FOUND for an id the workspace does not hold."
          },
          "409": {
            "description": "GATEWAY_NOT_READY, GATEWAY_TOKEN_NOT_ISSUED or GATEWAY_TOKEN_ALREADY_REVEALED."
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED."
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/gateway-token/regenerate": {
      "post": {
        "operationId": "regenerateHostedGatewayToken",
        "summary": "Make a new gateway token for one gateway, shown once and kept pending",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. Acts on the gateway deployment_id names, else the primary, once it has been ready. Returns a new 256-bit token exactly once and keeps it pending, sealed; the gateway goes on sending the token in use until the token is activated, so the tenant's API can accept both first. Regenerating again replaces a pending token not yet activated. An explicit id the workspace does not hold is 404 GATEWAY_NOT_FOUND.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpEmpty"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The pending gateway token; store it at once where the tenant's API reads it.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayPendingToken"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, ADMIN or OWNER required, or VERIFIED_EMAIL_REQUIRED."
          },
          "404": {
            "description": "GATEWAY_NOT_FOUND for an id the workspace does not hold."
          },
          "409": {
            "description": "GATEWAY_NOT_READY."
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED."
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/gateway-token/activate": {
      "post": {
        "operationId": "activateHostedGatewayToken",
        "summary": "Switch one gateway to its pending gateway token",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. Acts on the gateway deployment_id names, else the primary. api_accepts_token is the administrator's statement that the tenant's API accepts the pending token. The pending token becomes the one in use and a provisioning job delivers it to every pod of the gateway; until the fleet confirms it, gateway_token.sent in the overview is false and pods may still send the previous token. With no token pending, a token in use that the fleet has not confirmed is delivered again. An explicit id the workspace does not hold is 404 GATEWAY_NOT_FOUND.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTokenActivation"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The switch is queued; the body is the gateway's overview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeploymentOverview"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST without api_accepts_token true."
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, ADMIN or OWNER required, or VERIFIED_EMAIL_REQUIRED."
          },
          "404": {
            "description": "GATEWAY_NOT_FOUND for an id the workspace does not hold."
          },
          "409": {
            "description": "GATEWAY_NOT_READY, GATEWAY_CONFIGURATION_LOCKED or GATEWAY_TOKEN_NOT_PENDING."
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED."
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/resources": {
      "get": {
        "operationId": "listHostedGatewayResources",
        "summary": "Read one gateway's resource inventory and secret-free TCP status",
        "description": "Account session scoped to the current workspace. Reads require workspace membership. Each gateway keeps its own inventory; deployment_id names one, else the primary, and an id the workspace does not hold is 404 GATEWAY_NOT_FOUND. Saving inventory alone does not activate routing. HTTPS connected status requires a verified deployed upstream; TCP connected status requires a fresh authenticated connector lease. TCP metadata is omitted and tcp_enabled is false when the default-off feature is disabled. HTTP and WebSocket forwarding remain unsupported.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayResources"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "Current workspace membership required."
          },
          "404": {
            "description": "GATEWAY_NOT_FOUND for an id the workspace does not hold."
          },
          "500": {
            "description": "Resource inventory or database unavailable."
          }
        }
      },
      "post": {
        "operationId": "addHostedGatewayResource",
        "summary": "Save a resource to one gateway's inventory",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. Saves to the gateway deployment_id names, else the primary; an id the workspace does not hold is 404 GATEWAY_NOT_FOUND. Saving never activates routing; a repeat returns the saved resource. At most 50 resources per gateway.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HostedGatewayDeploymentSelector"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayResourceInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Already saved; the gateway's inventory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayResourceAdded"
                }
              }
            }
          },
          "201": {
            "description": "Saved; the gateway's inventory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayResourceAdded"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_GATEWAY_RESOURCE or INVALID_REQUEST."
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, ADMIN or OWNER required, or VERIFIED_EMAIL_REQUIRED."
          },
          "404": {
            "description": "GATEWAY_NOT_FOUND for an id the workspace does not hold."
          },
          "409": {
            "description": "GATEWAY_DEPLOYMENT_REQUIRED before any gateway is reserved, or GATEWAY_RESOURCE_LIMIT_REACHED."
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED."
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/resources/{id}/tcp/activate": {
      "post": {
        "operationId": "activateHostedGatewayTcp",
        "summary": "Default off: authorize an opaque TCP connector route",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. The organization comes only from the session. Requests are closed and limited to 4096 bytes. TCP forwarding is opaque and does not evaluate SQL or API commands. Default off. Explicit accept_terms:true authorizes a saved tcp_ip resource with a numeric IPv4/IPv6 address and explicit port. Current paid active entitlement is required. Queue an identifier-only worker job; the worker probes only the derived tenant gateway capability endpoint. No HTTPS origin is required and the shared fleet never dials the saved target. Idempotent while the current route is ready or provisioning.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Saved resource UUID in the current workspace; also the TCP route UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpActivate"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayResources"
                }
              }
            }
          },
          "400": {
            "description": "TCP_RESOURCE_REQUIRED, TCP_PORT_REQUIRED or ordinary validation refusal."
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "TCP_AUTHORIZATION_REFUSED, HOSTED_GATEWAY_ADMIN_REQUIRED, HOSTED_GATEWAY_PAID_PLAN_REQUIRED or HOSTED_GATEWAY_ENTITLEMENT_INACTIVE. Current authorizing administrator membership and paid active entitlement are rechecked; no fallback authorization. SAME_SITE_REQUEST_REQUIRED or VERIFIED_EMAIL_REQUIRED also refuses the request."
          },
          "404": {
            "description": "TCP_RESOURCE_NOT_FOUND in this workspace."
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/HostedGatewayTcpRateLimited"
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/resources/{id}/tcp/disable": {
      "post": {
        "operationId": "disableHostedGatewayTcp",
        "summary": "Revoke a TCP route and both role credentials",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. The organization comes only from the session. Requests are closed and limited to 4096 bytes. TCP forwarding is opaque and does not evaluate SQL or API commands. Works while the TCP feature is disabled. Increments generation, clears both role credentials, and removes tickets and live leases. Existing broker legs close by their last valid 30-second lease expiry. Other resources and HTTPS routing are unchanged.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Saved resource UUID in the current workspace; also the TCP route UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpEmpty"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayResources"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/HostedGatewayTcpInvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, VERIFIED_EMAIL_REQUIRED or insufficient workspace role."
          },
          "404": {
            "description": "TCP_ROUTE_NOT_FOUND in this workspace."
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/HostedGatewayTcpRateLimited"
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/public/account/workspace/deployments/resources/{id}/tcp/credentials/reveal": {
      "post": {
        "operationId": "revealHostedGatewayTcpCredentials",
        "summary": "Reveal both TCP credentials once for the expected generation",
        "description": "Signed account session, current workspace ADMIN or OWNER and verified email; same-site JSON is mandatory. The organization comes only from the session. Requests are closed and limited to 4096 bytes. TCP forwarding is opaque and does not evaluate SQL or API commands. Default off. Requires the route to be ready and its current authorizing administrator to retain paid active entitlement. The generation from the latest resource read is compared under the route lock before disclosure is consumed. Stale requests never consume replacement credentials. Do not cache, log or automatically retry a credential disclosure.",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Saved resource UUID in the current workspace; also the TCP route UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpReveal"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTcpCredentials"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/HostedGatewayTcpInvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpSessionRequired"
          },
          "403": {
            "description": "TCP_AUTHORIZATION_REFUSED, HOSTED_GATEWAY_ADMIN_REQUIRED, HOSTED_GATEWAY_PAID_PLAN_REQUIRED or HOSTED_GATEWAY_ENTITLEMENT_INACTIVE. Current authorizing administrator membership and paid active entitlement are rechecked; no fallback authorization. SAME_SITE_REQUEST_REQUIRED or VERIFIED_EMAIL_REQUIRED also refuses the request."
          },
          "404": {
            "description": "TCP_ROUTE_NOT_FOUND in this workspace."
          },
          "409": {
            "description": "TCP_GENERATION_CHANGED (no credentials consumed), TCP_NOT_READY, or TCP_CREDENTIALS_ALREADY_REVEALED. Refresh the route before any new request."
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/HostedGatewayTcpRateLimited"
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/public/gateway/tcp/tickets": {
      "post": {
        "operationId": "issueHostedGatewayTcpTicket",
        "summary": "Default off: exchange a role credential for a one-use TCP ticket",
        "description": "Default off. Native connectors and local tunnels supply the matching role credential in Authorization, never an organization API key. Rechecks ready route, current generation, role and the authorizing administrator's current paid active entitlement. A ticket expires in 60 seconds and is redeemed atomically once by the broker. At most 32 outstanding tickets per route, 120 requests/minute and 4096-byte JSON bodies. Compare route_id, tenant_host, gateway_url and the canonical resource/hash against local configuration before CONNECT. The service never receives TCP payloads or chooses a connector target.",
        "security": [
          {
            "HostedGatewayTcpRouteCredential": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpTicketRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTcpTicketResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/HostedGatewayTcpInvalidRequest"
          },
          "401": {
            "description": "TCP_CREDENTIAL_REQUIRED: a 43-character opaque route bearer is required."
          },
          "403": {
            "$ref": "#/components/responses/HostedGatewayTcpAuthorizationRefused"
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "description": "TCP_TICKET_LIMIT or request rate limit reached."
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/internal/gateway/tcp/redeem": {
      "post": {
        "operationId": "redeemHostedGatewayTcpTicket",
        "summary": "Default off, broker only: redeem a TCP ticket into a lease",
        "description": "Internal broker only; excluded from public SDK methods. Default off. Check exact tenant, route, role, generation, credential, unconsumed ticket and current authorizing administrator/paid authority. Atomic admission limits are 128 live legs globally, 16 per organization and 8 per route. A consumed ticket remains consumed after broker restart. Compare every returned lease binding. Strict JSON, 4096-byte bodies, 2000 requests/minute.",
        "security": [
          {
            "HostedGatewayTcpBrokerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpRedeem"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTcpLeaseGrant"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/HostedGatewayTcpInvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpServiceUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/HostedGatewayTcpAuthorizationRefused"
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "description": "TCP_CONNECTION_LIMIT or request rate limit reached."
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/internal/gateway/tcp/leases/refresh": {
      "post": {
        "operationId": "refreshHostedGatewayTcpLease",
        "summary": "Default off, broker only: renew a still-valid TCP lease",
        "description": "Internal broker only; excluded from public SDK methods. Default off. Refresh every 10 seconds. Recheck enabled route, generation, role credential and current authorizing administrator membership and paid active entitlement. Return the same bound grant with at most 30 seconds of validity; an expired lease never revives and total lifetime cannot exceed one hour. The broker closes a leg before the last valid expiry if renewal fails. Strict JSON, 4096-byte bodies, 2000 requests/minute.",
        "security": [
          {
            "HostedGatewayTcpBrokerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpLeaseRefresh"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTcpLeaseGrant"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/HostedGatewayTcpInvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpServiceUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/HostedGatewayTcpAuthorizationRefused"
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/HostedGatewayTcpRateLimited"
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/internal/gateway/tcp/leases/close": {
      "post": {
        "operationId": "closeHostedGatewayTcpLease",
        "summary": "Broker only: release a TCP lease and connector presence",
        "description": "Internal broker only; excluded from public SDK methods. Works while the feature is disabled. Idempotently release a missing lease; an existing lease requires its matching opaque token. This does not disable a route or authorize traffic. Strict JSON, 4096-byte bodies, 2000 requests/minute.",
        "security": [
          {
            "HostedGatewayTcpBrokerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpLeaseClose"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTcpLeaseClosed"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/HostedGatewayTcpInvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpServiceUnauthorized"
          },
          "403": {
            "description": "TCP_AUTHORIZATION_REFUSED: an existing lease token does not match."
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/HostedGatewayTcpRateLimited"
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/internal/gateway/tcp/health": {
      "post": {
        "operationId": "checkHostedGatewayTcpHealth",
        "summary": "Broker only: prove control API authentication and database readiness",
        "description": "Internal broker only; excluded from public SDK methods. Requires the configured dedicated broker bearer and a successful database check. Works while HOSTED_GATEWAY_TCP_ENABLED is false; ready:true grants no traffic authority. The broker caches a successful probe at most 10 seconds and expires readiness proof after 30 seconds; authentication refusal invalidates it immediately. Strict empty JSON, 4096-byte bodies, 2000 requests/minute.",
        "security": [
          {
            "HostedGatewayTcpBrokerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpEmpty"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTcpHealth"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/HostedGatewayTcpInvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpServiceUnauthorized"
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/HostedGatewayTcpRateLimited"
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/internal/gateway/tcp/routes/{id}/process": {
      "post": {
        "operationId": "processHostedGatewayTcpRoute",
        "summary": "Default off, worker only: provision a queued TCP route",
        "description": "Internal worker only; excluded from public SDK methods. Default off. Identifier-only job, no target or organization selected by the caller. Use the organization's reserved domain and probe only its fixed HTTPS /_agentsafe/tcp/capabilities endpoint. Require transport:agentsafe-tcp-relay/1 and ready:true. Redirects and unexpected responses fail closed. This does not require or activate an HTTPS upstream. Strict empty JSON, at most 1024 bytes.",
        "security": [
          {
            "HostedGatewayWorkerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Saved resource UUID in the current workspace; also the TCP route UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTcpEmpty"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private bounded result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTcpProcessResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/HostedGatewayTcpInvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/HostedGatewayTcpServiceUnauthorized"
          },
          "404": {
            "description": "TCP_ROUTE_NOT_FOUND."
          },
          "409": {
            "description": "TCP_PROVISIONING_LEASED: another worker holds the bounded provisioning lease."
          },
          "415": {
            "$ref": "#/components/responses/HostedGatewayTcpJsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/HostedGatewayTcpRateLimited"
          },
          "503": {
            "$ref": "#/components/responses/HostedGatewayTcpUnavailable"
          }
        }
      }
    },
    "/v1/hosted-gateway/workspaces/{id}/deployment-limit": {
      "post": {
        "operationId": "setHostedGatewayDeploymentLimit",
        "summary": "Grant a workspace capacity for more hosted gateways (fleet operator)",
        "security": [
          {
            "OperatorEntraAuth": []
          }
        ],
        "description": "The fleet operator, with their own Microsoft Entra token (GatewayOperations.py limit), sets how many hosted gateways the workspace may hold, from 1 to 10. Core locks the workspace, refuses a limit below the gateways it already holds, and records the verified operator and the reason in hosted_gateway.limit.changed. It changes neither billing nor any customer consent, and accepts no operator identity, plan or workspace key from the body. Twenty calls per hour per operator.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The workspace (organization) id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayDeploymentLimitRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The limit now in force.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeploymentLimit"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST, or GATEWAY_LIMIT_INVALID outside 1 to 10."
          },
          "401": {
            "description": "OPERATOR_TOKEN_REQUIRED or an invalid operator token."
          },
          "403": {
            "description": "OPERATOR_ROLE_REQUIRED."
          },
          "404": {
            "description": "WORKSPACE_NOT_FOUND."
          },
          "409": {
            "description": "GATEWAY_LIMIT_BELOW_USAGE."
          },
          "429": {
            "description": "Operator rate limit reached."
          },
          "503": {
            "description": "OPERATOR_AUTH_NOT_CONFIGURED or GATEWAY_OPERATION_UNAVAILABLE."
          }
        }
      }
    },
    "/v1/hosted-gateway/authorizations": {
      "post": {
        "operationId": "startHostedGatewayAuthorization",
        "summary": "Start a hosted gateway sign-on for a paying tenant (fleet operator)",
        "security": [
          {
            "OperatorEntraAuth": []
          }
        ],
        "description": "Device-authorization grant (RFC 8628 shaped) by which a paying tenant\nof the AgentSafe hosted gateway fleet receives its workspace key\nwithout anyone copying one. The fleet operator (Tenant.py) starts it\nwith a Microsoft Entra access token for\n`api://decionis-operator/Operator.Act` whose `roles` holds the operator\nrole; who asked (`oid`, sign-in name) is recorded from the verified\ntoken, never from the body, and a body naming a requester is refused.\nThe customer then approves at `verification_uri_complete` while signed\nin to Decionis as `owner_email` by a sign-in that proved that address,\nADMIN or above in a workspace on a paid plan with an active\nentitlement, and the operator polls the token endpoint. Codes live 30\nminutes; poll every `interval` seconds. Twenty starts per hour per\noperator. Without Entra configuration\n(DECIONIS_OPERATOR_ENTRA_TENANT_ID, DECIONIS_OPERATOR_ENTRA_CLIENT_ID,\nand a well-formed DECIONIS_OPERATOR_ENTRA_CLIENT_APPS when set) every\ncall answers 503 OPERATOR_AUTH_NOT_CONFIGURED.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayAuthorizationStart"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The authorization; `device_code` stays with the operator, the customer is sent `verification_uri_complete` (or the URI and `user_code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeviceAuthorization"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "OPERATOR_TOKEN_REQUIRED or OPERATOR_TOKEN_INVALID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "OPERATOR_ROLE_REQUIRED, or OPERATOR_CLIENT_NOT_ALLOWED (the token was issued to a client application other than Azure CLI or one DECIONIS_OPERATOR_ENTRA_CLIENT_APPS names)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "OPERATOR_AUTH_NOT_CONFIGURED, OPERATOR_AUTH_UNAVAILABLE (the tenant's keys could not be read), HOSTED_GATEWAY_RATE_LIMIT_UNAVAILABLE or HOSTED_GATEWAY_CODE_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/hosted-gateway/authorizations/token": {
      "post": {
        "operationId": "redeemHostedGatewayAuthorization",
        "summary": "Poll a hosted gateway sign-on for its workspace key (fleet operator)",
        "security": [
          {
            "OperatorEntraAuth": []
          }
        ],
        "description": "The operator's poll, with the same Entra token as the start: a device\ncode redeems only for the operator who started it. Until the customer\ndecides, it answers `authorization_pending` (or `slow_down`, with a\n5 s wider `interval`, when polled sooner than the interval allows).\nOnce approved, the next poll first applies approval's workspace rules\nagain (the approver ADMIN or above, a paid plan, an active\nentitlement); a workspace that no longer qualifies denies the\nauthorization (`access_denied` with a `reason`), and Accounts being\nunreachable answers 503 `temporarily_unavailable` to retry, nothing\nminted. Otherwise it mints the key in the same transaction that\nconsumes the authorization and makes it the tenant's current key (one\nper organization and tenant label), and returns it exactly once: a\nMEMBER key named `agentsafe-hosted-<tenant_label>` with scopes\n`[\"decision:shadow\"]`, created by the approver. The key expires at\n`confirm_by` (10 minutes) unless the holder calls\nPOST /v1/hosted-gateway/keys/confirm with it, so a key whose delivery\nwas never confirmed does not stay active. The tenant's earlier keys\n(`replaced_key_ids`) stay live until that confirmation revokes them,\nexcept one that was itself never delivered, which is revoked now; a\nnew key that is lost in transit never leaves the tenant without one.\nLater polls answer `invalid_grant`. Sixty polls per minute per\noperator.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The workspace key; it appears only here",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayIssuedKey"
                }
              }
            }
          },
          "400": {
            "description": "An RFC 8628 / RFC 6749 token error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayTokenError"
                }
              }
            }
          },
          "401": {
            "description": "OPERATOR_TOKEN_REQUIRED or OPERATOR_TOKEN_INVALID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "OPERATOR_ROLE_REQUIRED or OPERATOR_CLIENT_NOT_ALLOWED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "`{\"error\": \"temporarily_unavailable\"}` when Accounts could not confirm the workspace's entitlement (nothing was minted; poll again), or OPERATOR_AUTH_NOT_CONFIGURED, OPERATOR_AUTH_UNAVAILABLE, HOSTED_GATEWAY_RATE_LIMIT_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/hosted-gateway/authorizations/lookup": {
      "post": {
        "operationId": "lookupHostedGatewayAuthorization",
        "summary": "Read a hosted gateway sign-on request by its user code (signed-in customer)",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "description": "What the approval page shows: the tenant and its host, the upstream\norigin, the operator who asked, when it expires, exactly what the\ngateway records (`disclosure`), and the signed-in user's workspaces\nwith whether each can take the key by the rules the database answers\n(ADMIN or above, a paid plan, API access); Accounts' entitlement is\nasked at approval. The owner email is shown in full only to that\nowner, and workspaces are listed only for them. Never returns the\ndevice code.\n\nA POST so the user code is never in a URL (and so never in a request\nlog line), from the page itself: `Sec-Fetch-Site: same-origin` (or,\nwithout it, the web application's own `Origin`) and a JSON body,\nas approve requires.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayLookupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request as the customer sees it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayLookup"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED or VERIFIED_EMAIL_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/hosted-gateway/authorizations/approve": {
      "post": {
        "operationId": "approveHostedGatewayAuthorization",
        "summary": "Approve a hosted gateway sign-on into one of the customer's workspaces",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "description": "From the page itself: the request must carry `Sec-Fetch-Site:\nsame-origin` (`same-site` is refused: the session cookie reaches every\nsubdomain) or, without it, an `Origin` that is the web application's\nown (the web proxy forwards the browser's headers), and a JSON body\n(415 JSON_CONTENT_TYPE_REQUIRED otherwise, so no form can send it).\nThe session must come from a sign-in that proved its email (an email\ncode, a password, Accounts, or an OAuth provider that asserted the\naddress verified; otherwise 403 VERIFIED_EMAIL_REQUIRED, sign in\nagain), that email must equal the request's owner email\n(case-insensitive), and the user must be ADMIN or above in `org_id`, a\nworkspace on a paid plan (`org_entitlements.plan_code`; a Stripe\nsubscription in `trialing` counts as its plan) whose entitlement\nAccounts holds active, all read at approval. On success the session\nis bound to `org_id` (a new account-session cookie is set when it was\nbound elsewhere), so the console's key list and billing show the\nworkspace that now holds the gateway's key.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayApproveRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approved; the operator's next poll receives the key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayApproval"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "description": "HOSTED_GATEWAY_PAID_PLAN_REQUIRED, with `plan_code` and `pricing_url`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayPaidPlanRequired"
                }
              }
            }
          },
          "403": {
            "description": "SAME_SITE_REQUEST_REQUIRED, VERIFIED_EMAIL_REQUIRED, HOSTED_GATEWAY_OWNER_MISMATCH, HOSTED_GATEWAY_ADMIN_REQUIRED or HOSTED_GATEWAY_ENTITLEMENT_INACTIVE (no API access, or Accounts does not hold the plan active; every gateway evaluation would be refused)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "HOSTED_GATEWAY_AUTHORIZATION_NOT_PENDING, with its `status`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "410": {
            "description": "HOSTED_GATEWAY_AUTHORIZATION_EXPIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "415": {
            "description": "JSON_CONTENT_TYPE_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "description": "ACCOUNT_AUTHORITY_UNAVAILABLE or HOSTED_GATEWAY_RATE_LIMIT_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/hosted-gateway/authorizations/deny": {
      "post": {
        "operationId": "denyHostedGatewayAuthorization",
        "summary": "Deny a hosted gateway sign-on request (signed-in owner)",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "description": "From the page itself (same-origin, JSON body, as approve), by the owner the request names, signed in by a sign-in that proved the email; the operator's next poll answers `access_denied`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedGatewayDenyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "authorization_id",
                    "tenant_label"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "denied"
                    },
                    "authorization_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenant_label": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "410": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/hosted-gateway/keys/{key_id}/revoke": {
      "post": {
        "operationId": "disconnectHostedGatewayKey",
        "summary": "Disconnect a hosted gateway by revoking its key (workspace admin)",
        "security": [
          {
            "AccountSessionCookie": []
          }
        ],
        "description": "From the page itself (same-origin, a JSON body such as `{}`, as approve). An ADMIN or above of the session's workspace revokes a key that a hosted gateway sign-on issued there (it appears in the workspace key list as `agentsafe-hosted-<tenant_label>` with scopes `[\"decision:shadow\"]`), including one that lapsed undelivered; the gateway records nothing more. Any other key answers 404.",
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayKeyRevocation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/hosted-gateway/keys/confirm": {
      "post": {
        "operationId": "confirmHostedGatewayKeyDelivery",
        "summary": "Confirm a just-issued hosted gateway key was received (the key itself)",
        "description": "Called with the key the token endpoint returned, as Bearer, before `confirm_by`. The key then no longer expires, and in the same transaction the tenant's earlier keys it replaces are revoked (`revoked_key_ids`). Idempotent: a second call revokes nothing more. A key no sign-on issued answers 404 HOSTED_GATEWAY_KEY_NOT_FOUND. A key that is revoked (superseded, disconnected, revoked by itself) or past `confirm_by` is refused by the org-key authentication before this route runs: 401 UNAUTHORIZED (\"Invalid API key\"). The 409s HOSTED_GATEWAY_KEY_RETIRED and HOSTED_GATEWAY_KEY_INACTIVE answer only a race with a concurrent retirement.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Delivery confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayDeliveryConfirmation"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHORIZED: the key is revoked, superseded, or past `confirm_by` (or none was presented)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "HOSTED_GATEWAY_KEY_RETIRED or HOSTED_GATEWAY_KEY_INACTIVE, only in a race with a concurrent retirement (otherwise such a key gets 401)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/hosted-gateway/keys/revoke-self": {
      "post": {
        "operationId": "revokeOwnApiKey",
        "summary": "Revoke the calling organization key (offboarding, rotation, failed onboarding)",
        "description": "Any database-backed organization key may revoke itself; a hosted gateway key also stops being its tenant's current key. Protocol and AWS service credentials and platform keys are refused (403). A key already revoked or expired gets 401 UNAUTHORIZED from the org-key authentication.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedGatewayKeyRevocation"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/protocol/policies/commerce/readiness": {
      "get": {
        "operationId": "getCommercePreflightReadiness",
        "summary": "Inspect the selected Commerce Gate policy configuration",
        "description": "Source candidate requiring the matching backend. Requires VIEWER access and policy:read, policy:* or org:* scope for the requested organization. Unknown or duplicate query fields are rejected. Reports configuration only; HTTP 200 does not approve an action, activate policy or prove connector or release readiness. Responses are private and must not be cached.",
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "policy_version",
            "in": "query",
            "required": false,
            "description": "Trimmed, nonempty policy version. When omitted, select the newest active bundle.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Configuration report, including missing, unsupported or unavailable states",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePreflightReadiness"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or duplicate query fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Organization, role or policy-read scope denied"
          },
          "502": {
            "description": "Policy service unavailable or returned an invalid or mismatched report"
          }
        }
      }
    },
    "/v1/protocol/commerce/data/sources": {
      "get": {
        "operationId": "listCommerceErpSources",
        "summary": "List authorized Business Central connections",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_DATA_ACCESS_ENABLED and COMMERCE_MCP_BUSINESS_CENTRAL_ENABLED, a live Accounts Microsoft purchase, current membership and signed v2 or v3 consent. An opaque connection identifies a separately verified company within the purchaser tenant extracted by Accounts. Reads are bounded to eight seconds and 100 documents, return no connector credentials, and cannot execute an ERP action. Connected v3 source discovery reports BC history unavailable; its historical tools cover only Walmart and Adobe. Requires erp:read.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceErpSources"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      }
    },
    "/v1/protocol/commerce/data/business-central/{connectionId}/orders": {
      "get": {
        "operationId": "readCommerceErpOrders",
        "summary": "Read bounded current Business Central orders",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_DATA_ACCESS_ENABLED and COMMERCE_MCP_BUSINESS_CENTRAL_ENABLED, a live Accounts Microsoft purchase, current membership and signed v2 or v3 consent. An opaque connection identifies a separately verified company within the purchaser tenant extracted by Accounts. Reads are bounded to eight seconds and 100 documents, return no connector credentials, and cannot execute an ERP action. Connected v3 source discovery reports BC history unavailable; its historical tools cover only Walmart and Adobe. Requires erp:read.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceErpOrders"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      }
    },
    "/v1/protocol/commerce/history/assessments": {
      "post": {
        "operationId": "startCommerceHistoryAssessment",
        "summary": "Assess the previous ninety complete dates",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_DATA_ACCESS_ENABLED and COMMERCE_MCP_BUSINESS_CENTRAL_ENABLED, a live Accounts Microsoft purchase, current membership and signed v2 or v3 consent. An opaque connection identifies a separately verified company within the purchaser tenant extracted by Accounts. Reads are bounded to eight seconds and 100 documents, return no connector credentials, and cannot execute an ERP action. Connected v3 source discovery reports BC history unavailable; its historical tools cover only Walmart and Adobe. This preserved BC historical flow admits only v2 erp:read and history:assess consent; v3 grants are refused. COMMERCE_HISTORY_ENABLED and an explicit history_assessment_limit_monthly in the verified publisher/offer/plan mapping are required; a missing limit disables assessments. Compares available historical merchandise margin against the exact selected policy floor over the previous ninety complete UTC dates. Missing costs or provenance are not_assessed; this is not full policy replay, execution authority, or a ninety-day trial. Results disclose partial coverage and are unsigned. One durable allowance reservation per new idempotent report; an exact completed retry returns the original report without another charge. An uncertain attempt is retained and cannot silently rerun.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceHistoryStart"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceHistoryAssessment"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "402": {
            "description": "Monthly history assessment allowance exhausted"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      }
    },
    "/v1/protocol/commerce/history/assessments/{assessmentId}": {
      "get": {
        "operationId": "getCommerceHistoryAssessment",
        "summary": "Read an immutable historical assessment",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_DATA_ACCESS_ENABLED and COMMERCE_MCP_BUSINESS_CENTRAL_ENABLED, a live Accounts Microsoft purchase, current membership and signed v2 or v3 consent. An opaque connection identifies a separately verified company within the purchaser tenant extracted by Accounts. Reads are bounded to eight seconds and 100 documents, return no connector credentials, and cannot execute an ERP action. Connected v3 source discovery reports BC history unavailable; its historical tools cover only Walmart and Adobe. This preserved BC historical flow admits only v2 erp:read and history:assess consent; v3 grants are refused. COMMERCE_HISTORY_ENABLED and an explicit history_assessment_limit_monthly in the verified publisher/offer/plan mapping are required; a missing limit disables assessments. Compares available historical merchandise margin against the exact selected policy floor over the previous ninety complete UTC dates. Missing costs or provenance are not_assessed; this is not full policy replay, execution authority, or a ninety-day trial. Results disclose partial coverage and are unsigned. Requires the same immutable Accounts user, workspace, membership and source entitlement; current authority and company connection are checked. Reading a saved report consumes no allowance.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assessmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceHistoryAssessment"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      }
    },
    "/v1/microsoft/business-central/connections": {
      "get": {
        "operationId": "listCommerceBusinessCentralConnections",
        "summary": "List administrable Business Central connections",
        "description": "Default off and outside the MCP OAuth profile. Requires a separate OWNER or ADMIN organization API key with org:integrations:write, org:* or * scope. Accounts must have supplied a fresh signed v2 or v3 purchaser tenant; the customer cannot enter or rebind tenant authority. Administrators authorize an environment/company and dedicated read-only BC application separately. Credentials are encrypted with an explicitly configured integration custody key and never returned. Verification performs bounded reads only; no ERP write is available.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceConnectionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      },
      "post": {
        "operationId": "createCommerceBusinessCentralConnection",
        "summary": "Register a company connection for verification",
        "description": "Default off and outside the MCP OAuth profile. Requires a separate OWNER or ADMIN organization API key with org:integrations:write, org:* or * scope. Accounts must have supplied a fresh signed v2 or v3 purchaser tenant; the customer cannot enter or rebind tenant authority. Administrators authorize an environment/company and dedicated read-only BC application separately. Credentials are encrypted with an explicitly configured integration custody key and never returned. Verification performs bounded reads only; no ERP write is available.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceConnectionCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceConnectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      }
    },
    "/v1/microsoft/business-central/connections/{connectionId}/verify": {
      "post": {
        "operationId": "verifyCommerceBusinessCentralConnection",
        "summary": "Verify read access to the company",
        "description": "Default off and outside the MCP OAuth profile. Requires a separate OWNER or ADMIN organization API key with org:integrations:write, org:* or * scope. Accounts must have supplied a fresh signed v2 or v3 purchaser tenant; the customer cannot enter or rebind tenant authority. Administrators authorize an environment/company and dedicated read-only BC application separately. Credentials are encrypted with an explicitly configured integration custody key and never returned. Verification performs bounded reads only; no ERP write is available.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceConnectionRevision"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceConnectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      }
    },
    "/v1/microsoft/business-central/connections/{connectionId}/credentials": {
      "post": {
        "operationId": "rotateCommerceBusinessCentralCredentials",
        "summary": "Rotate a connection credential and require re-verification",
        "description": "Default off and outside the MCP OAuth profile. Requires a separate OWNER or ADMIN organization API key with org:integrations:write, org:* or * scope. Accounts must have supplied a fresh signed v2 or v3 purchaser tenant; the customer cannot enter or rebind tenant authority. Administrators authorize an environment/company and dedicated read-only BC application separately. Credentials are encrypted with an explicitly configured integration custody key and never returned. Verification performs bounded reads only; no ERP write is available.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceConnectionCredentials"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceConnectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      }
    },
    "/v1/microsoft/business-central/connections/{connectionId}/disconnect": {
      "post": {
        "operationId": "disconnectCommerceBusinessCentralConnection",
        "summary": "Disconnect a company source and delete its stored credential",
        "description": "Default off and outside the MCP OAuth profile. Requires a separate OWNER or ADMIN organization API key with org:integrations:write, org:* or * scope. Accounts must have supplied a fresh signed v2 or v3 purchaser tenant; the customer cannot enter or rebind tenant authority. Administrators authorize an environment/company and dedicated read-only BC application separately. Credentials are encrypted with an explicitly configured integration custody key and never returned. Verification performs bounded reads only; no ERP write is available.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceConnectionRevision"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result; no downstream action is executed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceConnectionDisconnected"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unexpected fields, or mismatched idempotency key"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current authority, consent, scope or organization denied"
          },
          "404": {
            "description": "Authorized source or report unavailable"
          },
          "409": {
            "description": "Source revision, policy, idempotency or uncertain attempt conflict"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Feature disabled or required authority, source or policy unavailable"
          }
        }
      }
    },
    "/v1/internal/commerce/connected/history/policy": {
      "get": {
        "operationId": "getCommerceConnectedHistoryPolicy",
        "summary": "Read the exact current historical comparison policy",
        "description": "Default off; only a dedicated commerceConnectedTransport credential is admitted. Enabled automatic onboarding additionally requires accountSourceAuthority:true with orgIds omitted. This is not a generic wildcard org key. Each handler independently verifies fresh Accounts signed authority, exact resource/source/plan/tenant/revision and the synced projection before disclosing any result. Generic fixed-orgIds service keys keep their existing permissions. Requires the transient source proof header, at least one approved Walmart or Adobe source and an explicit nonzero or null history allowance. Reads the selected exact version; never chooses a default or writes policy.",
        "security": [
          {
            "CommerceConnectedTransport": []
          }
        ],
        "parameters": [
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "policy_version",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "x-org-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Must equal the body/query organization and the independently verified Accounts source UUID."
          },
          {
            "name": "x-commerce-source-authority",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 10923,
              "pattern": "^[A-Za-z0-9_-]+$"
            },
            "description": "Private, transient Accounts source-v3 proof from the current OAuth credential context. Unpadded base64url of canonical sorted-key JSON UTF-8, at most 8192 decoded bytes. Never a customer token; never persist or log it."
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "org_id",
                    "policy"
                  ],
                  "properties": {
                    "org_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "policy": {
                      "$ref": "#/components/schemas/CommerceMarketplaceHistoryPolicy"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/internal/commerce/connected/history/compare": {
      "post": {
        "operationId": "compareCommerceConnectedMarketplaceHistory",
        "summary": "Compare bounded observed Walmart or Adobe history",
        "description": "Default off; only a dedicated commerceConnectedTransport credential is admitted. Enabled automatic onboarding additionally requires accountSourceAuthority:true with orgIds omitted. This is not a generic wildcard org key. Each handler independently verifies fresh Accounts signed authority, exact resource/source/plan/tenant/revision and the synced projection before disclosing any result. Generic fixed-orgIds service keys keep their existing permissions. Requires the transient source proof header and its exact supported marketplace source. Pure comparison of at most 100 documents over the previous 90 complete UTC dates against the exact policy digest. Evaluates only supported historical undercost, margin, discount stacking and price discrepancy facts; missing evidence is not_assessed. The report is unsigned, performs no full policy replay or external action, and is not a 90-day trial. Commerce owns source reads, report reservations and immutable persistence.",
        "security": [
          {
            "CommerceConnectedTransport": []
          }
        ],
        "parameters": [
          {
            "name": "x-org-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Must equal the body/query organization and the independently verified Accounts source UUID."
          },
          {
            "name": "x-commerce-source-authority",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 10923,
              "pattern": "^[A-Za-z0-9_-]+$"
            },
            "description": "Private, transient Accounts source-v3 proof from the current OAuth credential context. Unpadded base64url of canonical sorted-key JSON UTF-8, at most 8192 decoded bytes. Never a customer token; never persist or log it."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceMarketplaceHistoryCompare"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceMarketplaceHistoryAssessment"
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/protocol/commerce/connected/approvals/evidence": {
      "post": {
        "operationId": "prepareCommerceConnectedApprovalEvidence",
        "summary": "Read minimized verified evidence for a named approval request",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_CONNECTED_ENABLED, the exact fresh nine-scope v3 consent, current Microsoft purchase and membership, and signed supported-source eligibility. It never upgrades a legacy v1 or v2 grant. Requires approval:request and current Accounts owner/admin. Only exact saved ORDER_ACCEPTANCE or REFUND_REQUEST SHADOW evidence and its current selected policy are admitted. Returns facts, missing/violated checks and verified dossier/action commitments. It neither completes a human approval nor executes an action.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceApprovalPrepare"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceApprovalEvidence"
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/internal/commerce/connected/approvals/revalidate": {
      "post": {
        "operationId": "revalidateCommerceConnectedHumanEvidence",
        "summary": "Revalidate a named human review's current source and dossier",
        "description": "Default off; only a dedicated commerceConnectedTransport credential is admitted. Enabled automatic onboarding additionally requires accountSourceAuthority:true with orgIds omitted. This is not a generic wildcard org key. Each handler independently verifies fresh Accounts signed authority, exact resource/source/plan/tenant/revision and the synced projection before disclosing any result. Generic fixed-orgIds service keys keep their existing permissions. The body authority is mandatory fresh Accounts accounts-commerce-human-review-v1 evidence with purpose commerce_human_review, bound to the exact case revision/context/action/dossier and expected source/workspace. A live product-session token is sent only to Accounts by the trusted BFF; this consumer accepts signed evidence only. It checks current source/policy/dossier and native company permissions. Commerce separately enforces named assignment, requester separation and the atomic human decision. No execution or stale OAuth extension is available.",
        "security": [
          {
            "CommerceConnectedTransport": []
          }
        ],
        "parameters": [
          {
            "name": "x-org-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Must equal the body/query organization and the independently verified Accounts source UUID."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceApprovalRevalidate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceApprovalRevalidated"
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/protocol/commerce/connected/business-central/{connectionId}/snapshot/{documentId}": {
      "get": {
        "operationId": "prepareCommerceNativeSnapshot",
        "summary": "Prepare current company-native order evidence and exact policy",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_CONNECTED_ENABLED, the exact fresh nine-scope v3 consent, current Microsoft purchase and membership, and signed supported-source eligibility. It never upgrades a legacy v1 or v2 grant. Also requires COMMERCE_MCP_BUSINESS_CENTRAL_NATIVE_ENABLED and a separately verified current company connection/native read grant within the purchaser tenant extracted by Accounts. No caller-supplied tenant, economics or source URL is accepted. Eight-second deadline and fixed bounded source reads apply. Requires erp:read and erp:validate. Returns an immutable snapshot digest, explicit cost provenance and exact signed policy. Admitted v2 evidence binds complete source cost from the verified effective company profile; v1 retains its native current-estimate provenance and missing landed cost. Preparation does not reserve budget or authorize an ERP write.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "policy_version",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceNativeSnapshotResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/protocol/commerce/connected/business-central/{connectionId}/preflight": {
      "post": {
        "operationId": "evaluateCommerceNativeShadowPreflight",
        "summary": "Record the confirmed current order's full SHADOW policy result",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_CONNECTED_ENABLED, the exact fresh nine-scope v3 consent, current Microsoft purchase and membership, and signed supported-source eligibility. It never upgrades a legacy v1 or v2 grant. Also requires COMMERCE_MCP_BUSINESS_CENTRAL_NATIVE_ENABLED and a separately verified current company connection/native read grant within the purchaser tenant extracted by Accounts. No caller-supplied tenant, economics or source URL is accepted. Eight-second deadline and fixed bounded source reads apply. Requires erp:read and erp:validate, explicit confirmation, snapshot digest, policy digest and matching idempotency header. Re-reads the exact source and executes the canonical sixteen-check Commerce SHADOW workflow with one durable evaluation reservation. Missing landed cost, inventory, promotion or other required facts produce HOLD. The original PROCEED/HOLD/BLOCK/ESCALATE verdict, signed dossier and policy identity remain visible. No callback or integration is dispatched. Commerce may separately request native margin and agent-budget authorization only after unchanged PROCEED.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9._:-]+$"
            },
            "description": "Must equal the confirmed body idempotency_key; retries cannot rebind the operation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceNativePreflightRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceNativePreflightResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "402": {
            "description": "Monthly evaluation reservation allowance exhausted"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/protocol/commerce/connected/business-central/{connectionId}/safety-settings": {
      "get": {
        "operationId": "getCommerceNativeSafetySettings",
        "summary": "Read actual company fallback settings and recorded outages",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_CONNECTED_ENABLED, the exact fresh nine-scope v3 consent, current Microsoft purchase and membership, and signed supported-source eligibility. It never upgrades a legacy v1 or v2 grant. Also requires COMMERCE_MCP_BUSINESS_CENTRAL_NATIVE_ENABLED and a separately verified current company connection/native read grant within the purchaser tenant extracted by Accounts. No caller-supplied tenant, economics or source URL is accepted. Eight-second deadline and fixed bounded source reads apply. Requires erp:read. Reads enabled status and provider-observed can_configure; enabled remains read-only.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "org_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceNativeSafetyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      },
      "patch": {
        "operationId": "setCommerceNativeFallbackMode",
        "summary": "Apply an explicitly confirmed company fallback-mode change",
        "description": "Default off; requires COMMERCE_MCP_OAUTH_CONNECTED_ENABLED, the exact fresh nine-scope v3 consent, current Microsoft purchase and membership, and signed supported-source eligibility. It never upgrades a legacy v1 or v2 grant. Also requires COMMERCE_MCP_BUSINESS_CENTRAL_NATIVE_ENABLED and a separately verified current company connection/native read grant within the purchaser tenant extracted by Accounts. No caller-supplied tenant, economics or source URL is accepted. Eight-second deadline and fixed bounded source reads apply. Requires erp:configure, current Accounts owner/admin, a separately verified native configure grant and provider-observed write permission. Only FAIL_OPEN/FAIL_CLOSED changes are supported. Exact old/new mode, settings ID, connection revision, nonwildcard ETag and idempotency must match the reviewed request. Adapter-proven non-writes are terminal NOT_APPLIED; uncertain outcomes stay reserved and never retry a PATCH. A read can reconcile only the same applied operation UUID. This settings change performs no financial ERP action.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9._:-]+$"
            },
            "description": "Must equal the confirmed body idempotency_key; retries cannot rebind the operation."
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 256
            },
            "description": "Exact nonwildcard settings ETag; must match expected_etag in the body."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceNativeFallbackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceNativeFallbackResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/microsoft/business-central/connections/{connectionId}/native-grant": {
      "post": {
        "operationId": "verifyCommerceNativePermissionGrant",
        "summary": "Verify and record narrow native company permissions",
        "description": "Default off and outside the MCP OAuth profile. Requires an ordinary OWNER/ADMIN organization key with org:integrations:write, org:* or *; no protocol service or OAuth credential is admitted. Tenant comes only from fresh signed Accounts purchaser evidence. A current verified company connection, unchanged revision and read-only native status proof are required. A configure grant additionally requires provider-observed company write permission. No provider credential is returned or financial ERP action performed.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceNativeGrantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "org_id",
                    "connection_id",
                    "connection_revision",
                    "permissions",
                    "verified_at"
                  ],
                  "properties": {
                    "org_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "connection_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "connection_revision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "enum": [
                          "read",
                          "configure"
                        ]
                      },
                      "minItems": 1,
                      "maxItems": 2
                    },
                    "verified_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/microsoft/business-central/connections/{connectionId}/native-grant/revoke": {
      "post": {
        "operationId": "revokeCommerceNativePermissionGrant",
        "summary": "Revoke native company permission at the expected revision",
        "description": "Default off and outside the MCP OAuth profile. Requires an ordinary OWNER/ADMIN organization key with org:integrations:write, org:* or *; no protocol service or OAuth credential is admitted. Tenant comes only from fresh signed Accounts purchaser evidence. A current verified company connection, unchanged revision and read-only native status proof are required. A configure grant additionally requires provider-observed company write permission. No provider credential is returned or financial ERP action performed.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "org_id",
                  "expected_revision"
                ],
                "properties": {
                  "org_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "expected_revision": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "revoked"
                  ],
                  "properties": {
                    "revoked": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/auth/credential-context": {
      "post": {
        "operationId": "getCommerceCredentialContext",
        "summary": "Resolve the current credential's authoritative product context",
        "description": "Returns the authenticated credential class and exact organization, role and scopes. Accounts owns OAuth and workspace issuance; Core consumes its signed purchased-workspace projection and never turns this response into a new OAuth or organization key. V1 base3 stays unchanged. V2 adds only its recognized profile/consent metadata. V3 privately adds oauth_authority and the existing signed oauth_source_authority for request-scoped product transport. The private evidence is never returned in MCP tools or persisted in reports. Service credentials are refused. Data and connected extensions are default off and require their exact freshly consented profiles.",
        "security": [
          {
            "CommerceAccountsOAuth": []
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "authority",
                    "org_id",
                    "role",
                    "scopes",
                    "api_key_id"
                  ],
                  "properties": {
                    "authority": {
                      "enum": [
                        "org_api_key",
                        "accounts_oauth",
                        "platform",
                        "onboarding"
                      ]
                    },
                    "org_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "role": {
                      "enum": [
                        "OWNER",
                        "ADMIN",
                        "MEMBER",
                        "VIEWER",
                        null
                      ]
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "api_key_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "policy_id": {
                      "description": "The named policy an organization key is bound to; evaluations through it that name no policy are decided by it. Null decides by the workspace default.",
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[a-z0-9][a-z0-9._-]{0,99}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "onboarding_scope": {
                      "const": "pilot_setup"
                    },
                    "oauth_profile": {
                      "const": "commerce"
                    },
                    "oauth_resource": {
                      "type": "string",
                      "format": "uri"
                    },
                    "oauth_grant_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "oauth_profile_version": {
                      "enum": [
                        2,
                        3
                      ]
                    },
                    "oauth_consent": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "consent_id",
                        "consent_text_version",
                        "consent_sha256"
                      ],
                      "properties": {
                        "consent_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "consent_text_version": {
                          "enum": [
                            "commerce-data-consent-v1",
                            "commerce-connected-consent-v1"
                          ]
                        },
                        "consent_sha256": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        }
                      }
                    },
                    "oauth_authority": {
                      "$ref": "#/components/schemas/CommerceConnectedAuthority"
                    },
                    "oauth_source_authority": {
                      "$ref": "#/components/schemas/CommerceConnectedSourceAuthority"
                    },
                    "initial_policy": {
                      "$ref": "#/components/schemas/CommerceInitialPolicy"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid, oversized or conflicting request fields"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Current signed authority, source, scope, role or company permission denied"
          },
          "404": {
            "description": "Authorized source, document or evidence unavailable"
          },
          "409": {
            "description": "Exact source, policy, evidence or idempotency binding changed; an uncertain write is never retried"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Default-off capability or required dependency unavailable"
          }
        }
      }
    },
    "/v1/internal/workspace-credentials/issue": {
      "post": {
        "operationId": "issueAccountsWorkspaceCredential",
        "summary": "Create a Core protocol key for an Accounts-authorized workspace",
        "description": "Disabled until the dedicated Accounts service credential is configured. Accounts authorizes current owner/admin membership and Commerce access, then signs a command bound to its exact organization, workspace, user, environment and protocol purpose. Core requires a synchronized existing workspace projection, verifies the signature through the configured Accounts JWKS and checks authorization expiry after lock waits. Commands expire within 60 seconds; issued_at may be at most 5 seconds ahead. command_id is globally immutable across actors, workspaces and actions; only authorization timestamps may change on retry. JSON only, no query parameters, cookies or Origin header. This creates no native platform connection and grants no ERP execution authority. Core uses its existing key generator and hash storage with fixed MEMBER decision:read/decision:write scopes. Only the first successful response discloses raw_key. No recoverable response ciphertext is stored. An authorized retry returns already_issued metadata; a lost first response requires explicit revocation and a new command.",
        "x-accounts-contract": {
          "id": "urn:decionis:accounts:workspace-credentials:v1",
          "sha256": "c2c79a0837f31b7e50ad632d78634c871f71e1e0ae351472a9851b6ea8ab7463"
        },
        "security": [
          {
            "AccountsWorkspaceCredentialService": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountsWorkspaceCredentialIssueEnvelope"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Previously issued credential metadata; no raw key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialAlreadyIssued"
                }
              }
            }
          },
          "201": {
            "description": "New credential; raw key disclosed once",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialIssued"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or conflicting bounded command fields",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "401": {
            "description": "Dedicated Accounts service authentication required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "403": {
            "description": "Command authority or exact workspace projection denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "404": {
            "description": "Credential is not in the authorized workspace namespace",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "409": {
            "description": "Command identity or credential binding conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "413": {
            "description": "Command exceeds the 8192-byte body limit",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "429": {
            "description": "Durable per-address or workspace request limit reached",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "503": {
            "description": "Credential adapter or required dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/internal/workspace-credentials/list": {
      "post": {
        "operationId": "listAccountsWorkspaceCredentials",
        "summary": "List Core key metadata for an Accounts-authorized workspace",
        "description": "Disabled until the dedicated Accounts service credential is configured. Accounts authorizes current owner/admin membership and Commerce access, then signs a command bound to its exact organization, workspace, user, environment and protocol purpose. Core requires a synchronized existing workspace projection, verifies the signature through the configured Accounts JWKS and checks authorization expiry after lock waits. Commands expire within 60 seconds; issued_at may be at most 5 seconds ahead. command_id is globally immutable across actors, workspaces and actions; only authorization timestamps may change on retry. JSON only, no query parameters, cookies or Origin header. This creates no native platform connection and grants no ERP execution authority. Returns at most 100 Accounts-provisioned credentials with a truncation indicator. Metadata contains no raw key or provider secret. Legacy connector credentials are outside this namespace.",
        "x-accounts-contract": {
          "id": "urn:decionis:accounts:workspace-credentials:v1",
          "sha256": "c2c79a0837f31b7e50ad632d78634c871f71e1e0ae351472a9851b6ea8ab7463"
        },
        "security": [
          {
            "AccountsWorkspaceCredentialService": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountsWorkspaceCredentialListEnvelope"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded credential metadata",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialListed"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or conflicting bounded command fields",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "401": {
            "description": "Dedicated Accounts service authentication required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "403": {
            "description": "Command authority or exact workspace projection denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "404": {
            "description": "Credential is not in the authorized workspace namespace",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "409": {
            "description": "Command identity or credential binding conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "413": {
            "description": "Command exceeds the 8192-byte body limit",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "429": {
            "description": "Durable per-address or workspace request limit reached",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "503": {
            "description": "Credential adapter or required dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/internal/workspace-credentials/revoke": {
      "post": {
        "operationId": "revokeAccountsWorkspaceCredential",
        "summary": "Revoke a Core key for an Accounts-authorized workspace",
        "description": "Disabled until the dedicated Accounts service credential is configured. Accounts authorizes current owner/admin membership and Commerce access, then signs a command bound to its exact organization, workspace, user, environment and protocol purpose. Core requires a synchronized existing workspace projection, verifies the signature through the configured Accounts JWKS and checks authorization expiry after lock waits. Commands expire within 60 seconds; issued_at may be at most 5 seconds ahead. command_id is globally immutable across actors, workspaces and actions; only authorization timestamps may change on retry. JSON only, no query parameters, cookies or Origin header. This creates no native platform connection and grants no ERP execution authority. Revokes only the exact key in the signed workspace credential namespace. Repeating the same authorized command is idempotent. Revocation does not modify a native provider connection.",
        "x-accounts-contract": {
          "id": "urn:decionis:accounts:workspace-credentials:v1",
          "sha256": "c2c79a0837f31b7e50ad632d78634c871f71e1e0ae351472a9851b6ea8ab7463"
        },
        "security": [
          {
            "AccountsWorkspaceCredentialService": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountsWorkspaceCredentialRevokeEnvelope"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revoked credential metadata",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialRevoked"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or conflicting bounded command fields",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "401": {
            "description": "Dedicated Accounts service authentication required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "403": {
            "description": "Command authority or exact workspace projection denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "404": {
            "description": "Credential is not in the authorized workspace namespace",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "409": {
            "description": "Command identity or credential binding conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "413": {
            "description": "Command exceeds the 8192-byte body limit",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "429": {
            "description": "Durable per-address or workspace request limit reached",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          },
          "503": {
            "description": "Credential adapter or required dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsWorkspaceCredentialError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/microsoft/business-central/connections/{connectionId}/payment-context": {
      "get": {
        "operationId": "getCommerceNativePaymentContext",
        "summary": "Resolve registered Business Central payment evidence context",
        "description": "A current ordinary organization key with decision:read and decision:write resolves only its synchronized Accounts workspace and exact active verified company connection with a current revision-bound native read grant. No query parameters or body are accepted. Missing configuration is unavailable; client-supplied organization or provider tenant claims grant no authority. The response contains non-secret registration metadata with basis=persisted_connection_and_native_grant, provider_read_authority=not_checked and execution_available=false, or true only for a connection whose payments Core decides with a single-use permit (the permit path); a permit claimed for one exact payment line, never this flag, lets a payment post. It does not read Microsoft payment facts, refresh Accounts provider authority, open provider credential custody or authorize posting. Existing native provider reads and configuration retain their separate fresh Accounts source and permission checks. Commerce binds subsequent queued assertions to all returned workspace/company/revision fields. Both scopes authorize payment evidence use, not a financial action.",
        "x-release-status": "source_candidate",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded private result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceNativeContext"
                }
              }
            }
          },
          "400": {
            "description": "Malformed connection id, body or query parameters"
          },
          "401": {
            "description": "Current organization API key required"
          },
          "403": {
            "description": "Credential class, role, scopes, expiry or revocation denied"
          },
          "404": {
            "description": "Exact synchronized workspace, verified connection or native grant unavailable"
          },
          "413": {
            "description": "Request body exceeds the bounded limit"
          },
          "429": {
            "description": "Request rate limit reached; retry after the returned Retry-After interval"
          },
          "503": {
            "description": "Registration metadata dependency unavailable; no provider call is made"
          }
        }
      }
    },
    "/v1/internal/native-enrollments/enroll": {
      "post": {
        "operationId": "enrollAccountsNativeEnrollment",
        "summary": "Verify an Accounts-authorized native READ registration",
        "description": "Default off. Accounts authorizes the current owner/admin of the exact existing Commerce workspace and signs a command. Core checks current Accounts JWKS and the SYNCED human workspace projection; no org, membership, merchant ADMIN key or Marketplace purchase is created. A command lease lasts at most 30 seconds, with at most 5 seconds future clock skew. JSON only; no query, Origin or Cookie. command_id has immutable semantic content; retries may refresh only issued_at and authorization_expires_at. No route executes a commerce or payment transaction. Requires fresh Entra tenant identity plus an exact operator-managed assignment to this Accounts/Core workspace, tenant, BC environment and company. Provider proof must be verified within 10 minutes of command issue and outlive its lease. Core selects its managed application and reads only the exact company and native guardSettings. Configured/enabled guard state is observed separately from READ permission. Atomic activation records an Accounts enrollment grant with can_configure=false. Reverification pins the existing enrollment/connection/revision and increments the revision. A successful immutable retry returns the original receipt without another provider read.",
        "x-accounts-contract": {
          "id": "urn:decionis:accounts:native-enrollment:v1",
          "sha256": "a51cdaa401f99a2c459af416e3c448eb802ff19193850afe0bc5534566daec84"
        },
        "security": [
          {
            "AccountsNativeEnrollmentService": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountsNativeEnrollmentEnrollEnvelope"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded enrollment metadata; execution_available remains false",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentEnrolled"
                }
              }
            }
          },
          "400": {
            "description": "Invalid bounded command or transport",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "401": {
            "description": "Dedicated Accounts service bearer required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "403": {
            "description": "Current Accounts, identity or managed assignment authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "404": {
            "description": "Exact enrollment is not in the authorized workspace",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "409": {
            "description": "Command conflict, concurrent attempt or changed connection revision",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "413": {
            "description": "Command exceeds 8192 bytes",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "429": {
            "description": "Durable address or workspace request limit reached",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "const": 10
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "const": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "503": {
            "description": "Enrollment disabled or required dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/internal/native-enrollments/revoke": {
      "post": {
        "operationId": "revokeAccountsNativeEnrollment",
        "summary": "Revoke an Accounts-owned native registration",
        "description": "Default off. Accounts authorizes the current owner/admin of the exact existing Commerce workspace and signs a command. Core checks current Accounts JWKS and the SYNCED human workspace projection; no org, membership, merchant ADMIN key or Marketplace purchase is created. A command lease lasts at most 30 seconds, with at most 5 seconds future clock skew. JSON only; no query, Origin or Cookie. command_id has immutable semantic content; retries may refresh only issued_at and authorization_expires_at. No route executes a commerce or payment transaction. Requires current workspace owner/admin and the exact existing enrollment, connection and revision. No Microsoft login or provider access is needed. Removes READ permission, disconnects the sealed connection and advances revision. Exact retries do not increment again.",
        "x-accounts-contract": {
          "id": "urn:decionis:accounts:native-enrollment:v1",
          "sha256": "a51cdaa401f99a2c459af416e3c448eb802ff19193850afe0bc5534566daec84"
        },
        "security": [
          {
            "AccountsNativeEnrollmentService": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountsNativeEnrollmentRevokeEnvelope"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded enrollment metadata; execution_available remains false",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentRevoked"
                }
              }
            }
          },
          "400": {
            "description": "Invalid bounded command or transport",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "401": {
            "description": "Dedicated Accounts service bearer required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "403": {
            "description": "Current Accounts, identity or managed assignment authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "404": {
            "description": "Exact enrollment is not in the authorized workspace",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "409": {
            "description": "Command conflict, concurrent attempt or changed connection revision",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "413": {
            "description": "Command exceeds 8192 bytes",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "429": {
            "description": "Durable address or workspace request limit reached",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "const": 10
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "const": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "503": {
            "description": "Enrollment disabled or required dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/internal/native-enrollments/status": {
      "post": {
        "operationId": "statusAccountsNativeEnrollment",
        "summary": "Recover the current identity of an Accounts-owned enrollment",
        "description": "Default off. Accounts authorizes the current owner/admin of the exact existing Commerce workspace and signs a command. Core checks current Accounts JWKS and the SYNCED human workspace projection; no org, membership, merchant ADMIN key or Marketplace purchase is created. A command lease lasts at most 30 seconds, with at most 5 seconds future clock skew. JSON only; no query, Origin or Cookie. command_id has immutable semantic content; retries may refresh only issued_at and authorization_expires_at. No route executes a commerce or payment transaction. Requires current workspace owner/admin and exact retained enrollment_id, without an old Microsoft proof or known connection ID. Recovers pending, active or revoked records. Historical provider observation time/guard flags never become fresh evidence. read_granted is computed from current persisted enrollment/grant and managed assignment eligibility; unavailable assignment authority reports false. No permission is created or renewed.",
        "x-accounts-contract": {
          "id": "urn:decionis:accounts:native-enrollment:v1",
          "sha256": "a51cdaa401f99a2c459af416e3c448eb802ff19193850afe0bc5534566daec84"
        },
        "security": [
          {
            "AccountsNativeEnrollmentService": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountsNativeEnrollmentStatusEnvelope"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded enrollment metadata; execution_available remains false",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentRecoveryResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid bounded command or transport",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "401": {
            "description": "Dedicated Accounts service bearer required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "403": {
            "description": "Current Accounts, identity or managed assignment authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "404": {
            "description": "Exact enrollment is not in the authorized workspace",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "409": {
            "description": "Command conflict, concurrent attempt or changed connection revision",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "413": {
            "description": "Command exceeds 8192 bytes",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "429": {
            "description": "Durable address or workspace request limit reached",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "const": 10
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "const": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          },
          "503": {
            "description": "Enrollment disabled or required dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsNativeEnrollmentError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/commerce/payments/workspace": {
      "post": {
        "operationId": "resolveCommercePaymentWorkspace",
        "summary": "Resolve the current payment workspace mapping",
        "description": "Default off. Current ordinary workspace API key with decision:read and decision:write; no runtime-key scope expansion. Metadata only: returns the exact SYNCED Accounts mapping after checking the current ordinary key. No provider read, key issuance or payment execution.",
        "x-commerce-contract": {
          "id": "urn:decionis:commerce:payment:evidence:v1",
          "sha256": "dc7e0634199c349a248c356c81294c80f2fd00514ee5c66893c152c297a338cf"
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommercePaymentWorkspaceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bound result. A grant, when one is bound, is a single-use permit for one exact payment line; Core executes nothing.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentWorkspaceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/commerce/payments/snapshot": {
      "post": {
        "operationId": "readCommercePaymentSnapshot",
        "summary": "Read the current native payment source snapshot",
        "description": "Default off. Current ordinary workspace API key with decision:read and decision:write; no runtime-key scope expansion. Fixed managed Business Central reader checks current connection/grant/assignment and exact native context, preserving the native observation time. Beneficiary verification remains unverified. Unsupported, stale, changing or locked source fails closed. No payment execution.",
        "x-commerce-contract": {
          "id": "urn:decionis:commerce:payment:evidence:v1",
          "sha256": "dc7e0634199c349a248c356c81294c80f2fd00514ee5c66893c152c297a338cf"
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommercePaymentSnapshotRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bound result. A grant, when one is bound, is a single-use permit for one exact payment line; Core executes nothing.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentSnapshotResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/commerce/payments/authorize": {
      "post": {
        "operationId": "authorizeCommercePaymentEvidenceAlias",
        "deprecated": true,
        "summary": "Evaluate a bound native payment (deprecated alias)",
        "description": "Default off. Current ordinary workspace API key with decision:read and decision:write; no runtime-key scope expansion. Deprecated alias of `POST /v1/commerce/payments/authorizations`: the same handler, kept for installed Commerce releases. Requires an immutable Commerce attempt, a fresh matching native snapshot, historical Accounts reviewer evidence plus fresh current authority, and the exact active approved policy pin. The whole Protocol policy and P12-P15 checks run. Transport retries retain the original input and expiry; no lease renewal. A policy result is not consent or an ERP write. Missing authority fails closed; HOLD and BLOCK remain stops. On a connection with the permit path on, a request may name the executor and the exact payment line's agent-safe.intent/1 intent; Core then binds one single-use grant to that intent and answers it under grant, with the permit fields a permit-style executor presents. Nothing executes until that permit is claimed, once.",
        "x-commerce-contract": {
          "id": "urn:decionis:commerce:payment:evidence:v1",
          "sha256": "dc7e0634199c349a248c356c81294c80f2fd00514ee5c66893c152c297a338cf"
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommercePaymentAuthorizationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bound result. A grant, when one is bound, is a single-use permit for one exact payment line; Core executes nothing.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentAuthorizationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/commerce/payments/authorizations": {
      "post": {
        "operationId": "authorizeCommercePaymentEvidence",
        "summary": "Evaluate a bound native payment with managed case evidence",
        "description": "Default off. Current ordinary workspace API key with decision:read and decision:write; no runtime-key scope expansion. Requires an immutable Commerce attempt, a fresh matching native snapshot, historical Accounts reviewer evidence plus fresh current authority, and the exact active approved policy pin. The whole Protocol policy and P12-P15 checks run. Transport retries retain the original input and expiry; no lease renewal. A policy result is not consent or an ERP write. Missing authority fails closed; HOLD and BLOCK remain stops. On a connection with the permit path on, a request may name the executor and the exact payment line's agent-safe.intent/1 intent; Core then binds one single-use grant to that intent and answers it under grant, with the permit fields a permit-style executor presents. Nothing executes until that permit is claimed, once.",
        "x-commerce-contract": {
          "id": "urn:decionis:commerce:payment:evidence:v1",
          "sha256": "dc7e0634199c349a248c356c81294c80f2fd00514ee5c66893c152c297a338cf"
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommercePaymentAuthorizationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bound result. A grant, when one is bound, is a single-use permit for one exact payment line; Core executes nothing.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentAuthorizationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Bounded refusal or unavailable dependency; no payment execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An organization API key. Its scopes decide what it may call;\n`decision:shadow` is the narrowest: SHADOW evaluations through\nPOST /v1/authority/grants or its alias\nPOST /v1/authority/enforce-and-bind only (DECISION_SHADOW_MODE_DENIED\nin any other mode; DECISION_SHADOW_FIELD_DENIED for a body carrying\n`context.decionis_policy`, `evidence` or `escalation`), with no\nintegration dispatch. A key whose only scope is `decision:shadow`\n(an AgentSafe hosted gateway's) reaches exactly those two,\nPOST /v1/auth/credential-context, POST /v1/hosted-gateway/keys/confirm\nand POST /v1/hosted-gateway/keys/revoke-self; every other route\nanswers 403 HOSTED_GATEWAY_KEY_PATH_DENIED.\n`decision:enforce` is an enforced hosted gateway's key: evaluations\nin SHADOW or ENFORCEMENT through POST /v1/authority/grants or its\nalias (400 DECISION_ENFORCE_FIELD_DENIED for a body carrying\n`context.decionis_policy`; it never holds `policy:write`), and the\ngrants and managed escalations they bind. A key whose scopes are\n`decision:enforce` (with or without `decision:shadow`) reaches exactly\nPOST /v1/authority/enforce-and-bind, POST /v1/authority/grants,\nGET /v1/authority/grants/{grant_id},\nPOST /v1/authority/grants/{grant_id}/claims,\nPOST /v1/authority/grants/{grant_id}/receipts,\nPOST /v1/authority/grants/{grant_id}/reconciliations,\nPOST /v1/execution/verify-token, POST /v1/execution/claim-token,\nPOST /v1/execution/consume-token, POST /v1/execution/finalize-token,\nGET /v1/authority/escalations/{escalation_id},\nDELETE /v1/authority/escalations/{escalation_id},\nPOST /v1/auth/credential-context, POST /v1/hosted-gateway/keys/confirm\nand POST /v1/hosted-gateway/keys/revoke-self, each id a UUID; every\nother route answers 403 HOSTED_GATEWAY_KEY_PATH_DENIED.\n"
      },
      "OperatorEntraAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "A fleet operator's Microsoft Entra v2 access token for the\n\"Decionis Operator API\" app registration (Application ID URI\napi://decionis-operator), as `az account get-access-token --scope\napi://decionis-operator/Operator.Act` returns it: issuer\nhttps://login.microsoftonline.com/<tenant>/v2.0, audience the app's\nclient id, `scp` holding Operator.Act, `roles` holding\nHostedGateway.Operator (or DECIONIS_OPERATOR_ENTRA_ROLE), and `azp`\nAzure CLI (04b07795-8ddb-461a-bbee-02f9e1bf7b46) or a client\nDECIONIS_OPERATOR_ENTRA_CLIENT_APPS names (403\nOPERATOR_CLIENT_NOT_ALLOWED otherwise), verified against the tenant's\nJWKS. The app registration should make Operator.Act admin-consent\nonly and require assignment on its enterprise application.\n"
      },
      "AccountSessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "decionis_account_session",
        "description": "The signed HttpOnly account session the web app holds after sign-in (also accepted as a Bearer `acct_` token)."
      },
      "HostedGatewayTcpRouteCredential": {
        "type": "http",
        "scheme": "bearer",
        "description": "A role-specific opaque 43-character connector or client credential revealed by the verified workspace administrator. Accepted only for TCP ticket issuance, never an organization API key, account session, worker credential or broker credential."
      },
      "HostedGatewayTcpBrokerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Internal service only: the dedicated HOSTED_GATEWAY_TCP_BROKER_TOKEN, at least 48 characters. Route credentials, organization API keys, account sessions and the worker token are never accepted. Never distribute this bearer to a customer or public SDK."
      },
      "HostedGatewayWorkerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Internal worker only: HOSTED_GATEWAY_WORKER_TOKEN, at least 32 characters. This grants processing of identifier-only provisioning jobs, never ticket redemption or lease renewal. Never distribute this bearer to a customer or public SDK."
      },
      "ProtocolServiceAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Dedicated protocol service credential with server-side organization authorization."
      },
      "CommerceAccountsOAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Opaque Accounts-issued Commerce OAuth access credential with resource-bound current purchase. Legacy base3, signed v2 ERP/history and fresh signed v3 nine-scope connected grants retain distinct route profiles. Refresh credentials never authenticate. Per-operation connection, current role, proof, quota and confirmation checks remain mandatory."
      },
      "CommerceConnectedTransport": {
        "type": "http",
        "scheme": "bearer",
        "description": "Dedicated service credential registered only for connected policy, comparison and human evidence transport. Requires a separate current signed source proof per call; never use a customer OAuth, refresh or product-session credential."
      },
      "AccountsWorkspaceCredentialService": {
        "type": "http",
        "scheme": "bearer",
        "description": "Private Accounts-to-Core service credential: ACCOUNTS_WORKSPACE_CREDENTIAL_SERVICE_TOKEN. Each request also requires fresh Accounts Ed25519 command evidence. Merchant keys, product sessions, native provider credentials and other service credentials do not authorize this endpoint."
      },
      "AccountsNativeEnrollmentService": {
        "type": "http",
        "scheme": "bearer",
        "description": "Dedicated ACCOUNTS_NATIVE_ENROLLMENT_SERVICE_TOKEN plus a fresh Accounts Ed25519 command. Merchant runtime keys, product sessions and other service credentials do not authorize this route."
      }
    },
    "parameters": {
      "HostedGatewayDeploymentSelector": {
        "name": "deployment_id",
        "in": "query",
        "required": false,
        "description": "One of the current workspace's gateways; omitted, the workspace's primary. The organization always comes from the session, never from a parameter.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "CorrelationId": {
        "name": "X-Correlation-ID",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "GrantId": {
        "name": "grantId",
        "in": "path",
        "required": true,
        "description": "The execution grant's `jti`: the `execution_token_jti` returned when the grant was issued, the `jti` recorded for the grant, and the `jti` claim of the signed execution token. The token remains the bearer proof; a token whose `jti` is not this id is refused with GRANT_ID_MISMATCH.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "ExecutionTokenHeader": {
        "name": "x-decionis-execution-token",
        "in": "header",
        "required": true,
        "description": "The execution token, as issued. Redacted from request logs.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 20000
        }
      },
      "UcpOrgId": {
        "name": "org_id",
        "in": "query",
        "required": false,
        "description": "Optional when the authenticated API key is already bound to an organization.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "PublicDossierId": {
        "name": "dossier_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "ShareLinkSignature": {
        "name": "sig",
        "in": "query",
        "required": true,
        "description": "The share-link capability from a dossier's verification envelope. An access gate, not proof of authenticity — the Ed25519 signatures in the proof bundle are what prove the dossier. A missing or wrong value returns the same 404 as an unknown dossier.",
        "schema": {
          "type": "string"
        }
      },
      "ShareLinkExpiry": {
        "name": "exp",
        "in": "query",
        "required": false,
        "description": "Expiry (epoch seconds) of a v2 org-scoped share link. Bound into the signature — stripping or editing it invalidates the link. Absent only on legacy expiry-less links, which deployments may refuse.",
        "schema": {
          "type": "string"
        }
      }
    },
    "headers": {
      "DecionisWarning": {
        "description": "Present only when Decionis made the decision but left something the request asked for undone: comma-separated codes, never a reason to treat the decision differently. A header rather than a body field, so a gate that mirrors the decision's closed shape never meets a field it does not know. `POLICY_ENFORCE_SCOPE_MISSING`: the context's `decionis_policy` asked for `enforce: true`, and the key holds none of `policy:write`, `policy:*` or `org:*` (the scopes POST /v1/protocol/policies/bundles requires), so no policy bundle was published; the event `policy.file.enforce_skipped` records it. `EXPECTED_EFFECT_DIGEST_MISSING`: a grant was issued under Protocol 1.1 for an intent that named no `expected_effect_digest`, so its effect can never be confirmed; send one in the intent to make it confirmable.",
        "schema": {
          "type": "string",
          "examples": [
            "POLICY_ENFORCE_SCOPE_MISSING",
            "EXPECTED_EFFECT_DIGEST_MISSING"
          ]
        }
      },
      "DecionisActionRequired": {
        "description": "On a live claim: what the executor still owes the authority. `FINALIZE_BEFORE_LEASE_EXPIRY`: report the attempt at the grant's `/receipts` before `claim_lease_expires_at`, or the claim is recorded INDETERMINATE and holds its scopes until it is reconciled.",
        "schema": {
          "type": "string",
          "enum": [
            "FINALIZE_BEFORE_LEASE_EXPIRY"
          ]
        }
      },
      "DecionisBlockingGrant": {
        "description": "On a claim refused with CURRENT_STATE_UNRESOLVED because an earlier claim on the same scope is INDETERMINATE: that claim's grant id (its `jti`), in the caller's own organisation, for its reconciliation.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "HostedGatewayTcpInvalidRequest": {
        "description": "INVALID_REQUEST or ordinary validation refusal for missing, oversized, invalid or unexpected body fields."
      },
      "HostedGatewayTcpSessionRequired": {
        "description": "The signed workspace account session is missing or invalid."
      },
      "HostedGatewayTcpAuthorizationRefused": {
        "description": "TCP_AUTHORIZATION_REFUSED, HOSTED_GATEWAY_ADMIN_REQUIRED, HOSTED_GATEWAY_PAID_PLAN_REQUIRED or HOSTED_GATEWAY_ENTITLEMENT_INACTIVE. Current authorizing administrator membership and paid active entitlement are rechecked; no fallback authorization."
      },
      "HostedGatewayTcpJsonRequired": {
        "description": "JSON_CONTENT_TYPE_REQUIRED."
      },
      "HostedGatewayTcpRateLimited": {
        "description": "Request rate or bounded connection capacity reached."
      },
      "HostedGatewayTcpUnavailable": {
        "description": "TCP_UNAVAILABLE when a required dependency is unavailable or a gated operation is disabled. Internal service configuration may return TCP_SERVICE_UNAVAILABLE. Fail closed; no ticket, lease or traffic authority is granted."
      },
      "HostedGatewayTcpServiceUnauthorized": {
        "description": "TCP_SERVICE_UNAUTHORIZED: dedicated service authentication failed; customer route, organization and account credentials are never accepted."
      },
      "Error": {
        "description": "Structured API error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "HostedGatewayTcpEmpty": {
        "type": "object",
        "additionalProperties": false,
        "required": [],
        "properties": {}
      },
      "HostedGatewayTcpRole": {
        "type": "string",
        "enum": [
          "connector",
          "client"
        ]
      },
      "HostedGatewayTcpActivate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "accept_terms"
        ],
        "properties": {
          "accept_terms": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "HostedGatewayTcpReveal": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "generation"
        ],
        "properties": {
          "generation": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Non-secret fencing generation. Discard stale reveals and clear displayed credentials when this changes."
          }
        }
      },
      "HostedGatewayTcpTicketRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "route_id",
          "role"
        ],
        "properties": {
          "route_id": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "$ref": "#/components/schemas/HostedGatewayTcpRole"
          }
        }
      },
      "HostedGatewayTcpTicketResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ticket",
          "expires_at",
          "route_id",
          "tenant_host",
          "gateway_url",
          "resource",
          "resource_hash"
        ],
        "properties": {
          "ticket": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Sensitive opaque capability; never put in a URL, log, analytics event or ordinary resource view."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "Z$"
          },
          "route_id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_host": {
            "type": "string",
            "maxLength": 253
          },
          "gateway_url": {
            "type": "string",
            "format": "uri"
          },
          "resource": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "resource_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 lowercase hex of the canonical saved numeric IP:port resource string, not a customer payload."
          }
        },
        "description": "A one-use ticket expires in 60 seconds. Verify every returned binding against local configuration before CONNECT; never infer authorization from shape alone. Roles have separate route credentials."
      },
      "HostedGatewayTcpCredentials": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "route_id",
          "tenant_host",
          "gateway_url",
          "resource",
          "resource_hash",
          "connector_credential",
          "client_credential"
        ],
        "properties": {
          "route_id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_host": {
            "type": "string",
            "maxLength": 253
          },
          "gateway_url": {
            "type": "string",
            "format": "uri"
          },
          "resource": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "resource_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 lowercase hex of the canonical saved numeric IP:port resource string, not a customer payload."
          },
          "connector_credential": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Sensitive opaque capability; never put in a URL, log, analytics event or ordinary resource view."
          },
          "client_credential": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Sensitive opaque capability; never put in a URL, log, analytics event or ordinary resource view."
          }
        },
        "description": "One-time disclosure after a matching generation and current authority check. Save the separate credentials in local files, never URLs, browser persistence or analytics. Losing this response requires disable and re-enable to replace credentials."
      },
      "HostedGatewayTcpRedeem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ticket",
          "route_id",
          "tenant_host",
          "role"
        ],
        "properties": {
          "ticket": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Sensitive opaque capability; never put in a URL, log, analytics event or ordinary resource view."
          },
          "route_id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_host": {
            "type": "string",
            "maxLength": 253
          },
          "role": {
            "$ref": "#/components/schemas/HostedGatewayTcpRole"
          }
        }
      },
      "HostedGatewayTcpLeaseRefresh": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "lease_id",
          "lease_token",
          "phase"
        ],
        "properties": {
          "lease_id": {
            "type": "string",
            "format": "uuid"
          },
          "lease_token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Sensitive opaque capability; never put in a URL, log, analytics event or ordinary resource view."
          },
          "phase": {
            "type": "string",
            "enum": [
              "waiting",
              "active"
            ]
          }
        }
      },
      "HostedGatewayTcpLeaseClose": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "lease_id",
          "lease_token"
        ],
        "properties": {
          "lease_id": {
            "type": "string",
            "format": "uuid"
          },
          "lease_token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Sensitive opaque capability; never put in a URL, log, analytics event or ordinary resource view."
          }
        }
      },
      "HostedGatewayTcpLeaseGrant": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "lease_id",
          "lease_token",
          "org_id",
          "route_id",
          "generation",
          "tenant_host",
          "role",
          "resource_hash",
          "expires_at"
        ],
        "properties": {
          "lease_id": {
            "type": "string",
            "format": "uuid"
          },
          "lease_token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Sensitive opaque capability; never put in a URL, log, analytics event or ordinary resource view."
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "route_id": {
            "type": "string",
            "format": "uuid"
          },
          "generation": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Non-secret fencing generation. Discard stale reveals and clear displayed credentials when this changes."
          },
          "tenant_host": {
            "type": "string",
            "maxLength": 253
          },
          "role": {
            "$ref": "#/components/schemas/HostedGatewayTcpRole"
          },
          "resource_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 lowercase hex of the canonical saved numeric IP:port resource string, not a customer payload."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "Z$"
          }
        },
        "description": "Broker-only 30-second lease grant. Compare every binding, refresh every 10 seconds, and close before the last valid expiry if renewal fails. Expired leases never revive; maximum leg lifetime is one hour. Route keys cannot redeem or renew a lease."
      },
      "HostedGatewayTcpLeaseClosed": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "closed"
        ],
        "properties": {
          "closed": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "HostedGatewayTcpHealth": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "transport",
          "ready"
        ],
        "properties": {
          "transport": {
            "type": "string",
            "const": "agentsafe-tcp-relay/1"
          },
          "ready": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "HostedGatewayTcpProcessResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "queued",
              "provisioning",
              "disabled",
              "failed"
            ]
          },
          "retry_after_seconds": {
            "type": "integer",
            "const": 15
          }
        }
      },
      "HostedGatewayTcpView": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "route_id",
          "generation",
          "state",
          "gateway_url",
          "connector_online",
          "last_seen_at",
          "credentials_available",
          "message"
        ],
        "properties": {
          "route_id": {
            "type": "string",
            "format": "uuid"
          },
          "generation": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Non-secret fencing generation. Discard stale reveals and clear displayed credentials when this changes."
          },
          "state": {
            "type": "string",
            "enum": [
              "provisioning",
              "awaiting_connector",
              "connected",
              "offline",
              "disabled",
              "failed"
            ]
          },
          "gateway_url": {
            "type": "string",
            "format": "uri"
          },
          "connector_online": {
            "type": "boolean"
          },
          "last_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "credentials_available": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          }
        },
        "description": "Secret-free resource metadata, omitted while TCP is disabled. route_id equals the saved resource UUID. Connected means a fresh broker-authenticated connector lease, not a successful application login or application-command inspection."
      },
      "HostedGatewayResource": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "type",
          "resource",
          "label",
          "created_at",
          "status",
          "status_message"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "url",
              "tcp_ip",
              "hostname"
            ]
          },
          "resource": {
            "type": "string",
            "maxLength": 2048
          },
          "label": {
            "type": "string",
            "maxLength": 100
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "connected",
              "pending_connection",
              "unsupported_transport"
            ]
          },
          "status_message": {
            "type": "string"
          },
          "tcp": {
            "$ref": "#/components/schemas/HostedGatewayTcpView"
          }
        }
      },
      "HostedGatewayResources": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "resources",
          "resource_limit",
          "tcp_enabled"
        ],
        "properties": {
          "resources": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/HostedGatewayResource"
            }
          },
          "resource_limit": {
            "type": "integer",
            "const": 50
          },
          "tcp_enabled": {
            "type": "boolean",
            "description": "Default false. The interface must hide TCP activation controls unless true."
          }
        }
      },
      "HostedGatewayDeploymentSummary": {
        "type": "object",
        "required": [
          "id",
          "tenant_host",
          "is_primary",
          "status",
          "running_mode"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_host": {
            "type": "string",
            "examples": [
              "acme.decionisedge.com"
            ]
          },
          "is_primary": {
            "type": "boolean",
            "description": "The gateway a request without deployment_id acts on."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "provisioning",
              "ready",
              "failed",
              "needs_configuration"
            ]
          },
          "running_mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "SHADOW",
              "ENFORCEMENT",
              null
            ],
            "description": "What the fleet last confirmed it runs; null before it runs."
          }
        }
      },
      "HostedGatewayDeploymentOverview": {
        "type": "object",
        "required": [
          "deployment",
          "credentials",
          "networking",
          "activation"
        ],
        "description": "One gateway's state, as the Deployments page shows it, and the list of the workspace's gateways.",
        "properties": {
          "deployment": {
            "type": [
              "object",
              "null"
            ],
            "description": "The selected gateway; null while the workspace has none.",
            "required": [
              "id",
              "tenant_label",
              "tenant_host",
              "gateway_url",
              "status",
              "runtime_verified"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "tenant_label": {
                "type": "string"
              },
              "tenant_host": {
                "type": "string"
              },
              "gateway_url": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "reserved",
                  "awaiting_gateway",
                  "authorized",
                  "disconnected"
                ]
              },
              "upstream_origin": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "runtime_verified": {
                "type": "boolean",
                "description": "True only after the provisioning worker confirms the hosted runtime."
              }
            }
          },
          "deployments": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/HostedGatewayDeploymentSummary"
            }
          },
          "deployment_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "How many gateways an operator granted this workspace; 1 unless raised."
          },
          "credentials": {
            "type": "array",
            "description": "The gateway's key to Decionis, by prefix and status only.",
            "items": {
              "type": "object"
            }
          },
          "gateway_token": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/HostedGatewayTokenStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "The token the gateway sends the tenant's API, by state only; null without a gateway."
          },
          "enforcement": {
            "type": "object"
          },
          "networking": {
            "type": "object"
          },
          "activation": {
            "type": "object"
          }
        }
      },
      "HostedGatewayDeploymentReservation": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "company_name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "Makes the primary gateway's label; the workspace name when omitted."
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "additional",
              "tenant_label"
            ],
            "properties": {
              "additional": {
                "type": "boolean",
                "const": true
              },
              "tenant_label": {
                "type": "string",
                "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$",
                "description": "The exact label of the further gateway, served at <tenant_label>.decionisedge.com.",
                "examples": [
                  "sitework"
                ]
              }
            }
          }
        ]
      },
      "HostedGatewayDeploymentActivation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "upstream_origin",
          "accept_terms"
        ],
        "properties": {
          "upstream_origin": {
            "type": "string",
            "maxLength": 2048,
            "examples": [
              "https://api.acme.example"
            ]
          },
          "accept_terms": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "HostedGatewayModeRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode",
          "accept_terms"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "ENFORCEMENT"
            ]
          },
          "accept_terms": {
            "type": "boolean",
            "const": true
          },
          "upstream_credential": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "header",
              "value"
            ],
            "description": "Enforcement only; sealed at once, never returned.",
            "properties": {
              "header": {
                "type": "string",
                "maxLength": 64
              },
              "value": {
                "type": "string",
                "maxLength": 8192,
                "writeOnly": true
              }
            }
          },
          "policy_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The named policy the gateway is decided by; null is the workspace default, omitted keeps it."
          }
        }
      },
      "HostedGatewayTokenStatus": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "header",
          "issued",
          "revealable",
          "sent",
          "sent_at",
          "pending_at"
        ],
        "properties": {
          "header": {
            "type": "string",
            "const": "AgentSafe-Gateway-Token"
          },
          "issued": {
            "type": "boolean",
            "description": "A token is in use for this gateway."
          },
          "revealable": {
            "type": "boolean",
            "description": "The token in use can be revealed, once, now."
          },
          "sent": {
            "type": "boolean",
            "description": "The fleet confirmed every pod sends the token in use."
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "pending_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a regenerated token, not yet activated, was made."
          }
        }
      },
      "HostedGatewayToken": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "gateway_token",
          "header",
          "sent"
        ],
        "properties": {
          "gateway_token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          },
          "header": {
            "type": "string",
            "const": "AgentSafe-Gateway-Token"
          },
          "sent": {
            "type": "boolean"
          }
        }
      },
      "HostedGatewayPendingToken": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "gateway_token",
          "header",
          "pending_at"
        ],
        "properties": {
          "gateway_token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          },
          "header": {
            "type": "string",
            "const": "AgentSafe-Gateway-Token"
          },
          "pending_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "HostedGatewayTokenActivation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "api_accepts_token"
        ],
        "properties": {
          "api_accepts_token": {
            "type": "boolean",
            "const": true,
            "description": "The tenant's API accepts the pending token; the gateway switches to it."
          }
        }
      },
      "HostedGatewayTenantKey": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "tenant_key",
          "header",
          "gateway_url"
        ],
        "properties": {
          "tenant_key": {
            "type": "string"
          },
          "header": {
            "type": "string",
            "const": "AgentSafe-Tenant-Key"
          },
          "gateway_url": {
            "type": "string"
          }
        }
      },
      "HostedGatewayResourceInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "resource",
          "type",
          "label"
        ],
        "properties": {
          "resource": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "type": {
            "type": "string",
            "enum": [
              "url",
              "tcp_ip",
              "hostname"
            ]
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      },
      "HostedGatewayResourceAdded": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "resources",
          "resource_limit",
          "tcp_enabled",
          "resource",
          "created"
        ],
        "properties": {
          "resources": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/HostedGatewayResource"
            }
          },
          "resource_limit": {
            "type": "integer",
            "const": 50
          },
          "tcp_enabled": {
            "type": "boolean"
          },
          "resource": {
            "$ref": "#/components/schemas/HostedGatewayResource"
          },
          "created": {
            "type": "boolean",
            "description": "False when the same resource was already saved to this gateway."
          }
        }
      },
      "HostedGatewayDeploymentLimitRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "limit",
          "reason"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 500,
            "description": "Why the capacity is granted; recorded with the operator's verified identity."
          }
        }
      },
      "HostedGatewayDeploymentLimit": {
        "type": "object",
        "required": [
          "org_id",
          "deployment_limit"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          }
        }
      },
      "HostedGatewayAuthorizationStart": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "tenant_label",
          "tenant_host",
          "upstream",
          "owner_email"
        ],
        "properties": {
          "tenant_label": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$",
            "description": "The tenant id in the fleet registry; www, api, status, admin and console are reserved.",
            "examples": [
              "acme"
            ]
          },
          "tenant_host": {
            "type": "string",
            "maxLength": 253,
            "description": "Where the tenant is served, `<tenant_label>.<fleet domain>`.",
            "examples": [
              "acme.decionisedge.com"
            ]
          },
          "upstream": {
            "type": "string",
            "maxLength": 2048,
            "description": "The tenant's upstream, https without credentials, query or fragment; its origin is what the customer is shown and approves.",
            "examples": [
              "https://api.acme.example"
            ]
          },
          "owner_email": {
            "type": "string",
            "format": "email",
            "maxLength": 320,
            "description": "Only a signed-in user with exactly this email (case-insensitive) may approve or deny."
          },
          "max_embedded_body_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16777216,
            "default": 65536,
            "description": "The tenant's embedding limit, so the approval page states it exactly."
          }
        }
      },
      "HostedGatewayDeviceAuthorization": {
        "type": "object",
        "required": [
          "authorization_id",
          "device_code",
          "user_code",
          "verification_uri",
          "verification_uri_complete",
          "expires_in",
          "interval"
        ],
        "properties": {
          "authorization_id": {
            "type": "string",
            "format": "uuid"
          },
          "device_code": {
            "type": "string",
            "pattern": "^dcn_hgd_[A-Za-z0-9_-]{43}$",
            "description": "Kept by the operator for polling; never shown to the customer or logged."
          },
          "user_code": {
            "type": "string",
            "pattern": "^[BCDFGHJKLMNPQRSTVWXZ]{4}-[BCDFGHJKLMNPQRSTVWXZ]{4}$"
          },
          "verification_uri": {
            "type": "string",
            "format": "uri",
            "examples": [
              "https://decionis.com/connect/edge"
            ]
          },
          "verification_uri_complete": {
            "type": "string",
            "format": "uri",
            "examples": [
              "https://decionis.com/connect/edge?code=BCDF-GHJK"
            ]
          },
          "expires_in": {
            "type": "integer",
            "const": 1800
          },
          "interval": {
            "type": "integer",
            "const": 5
          }
        }
      },
      "HostedGatewayTokenRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "device_code"
        ],
        "properties": {
          "device_code": {
            "type": "string",
            "maxLength": 200
          },
          "grant_type": {
            "type": "string",
            "const": "urn:ietf:params:oauth:grant-type:device_code"
          }
        }
      },
      "HostedGatewayTokenError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "authorization_pending",
              "slow_down",
              "access_denied",
              "expired_token",
              "invalid_grant",
              "invalid_request"
            ],
            "description": "`invalid_grant`: an unknown device code, another operator's, or one already redeemed. `access_denied`: the owner denied it, or (with `reason`) the approved workspace no longer qualified when the key was to be minted."
          },
          "interval": {
            "type": "integer",
            "description": "On authorization_pending and slow_down, the seconds to wait before the next poll."
          },
          "reason": {
            "type": "string",
            "enum": [
              "HOSTED_GATEWAY_ADMIN_REQUIRED",
              "HOSTED_GATEWAY_PAID_PLAN_REQUIRED",
              "HOSTED_GATEWAY_ENTITLEMENT_INACTIVE"
            ],
            "description": "On access_denied only when the workspace stopped qualifying between approval and redemption (approver no longer ADMIN or above, plan no longer paid, entitlement inactive). Absent when the owner denied it."
          },
          "error_description": {
            "type": "string",
            "description": "A sentence for the operator, with `reason`."
          }
        }
      },
      "HostedGatewayIssuedKey": {
        "type": "object",
        "required": [
          "api_key",
          "key_id",
          "key_name",
          "org_id",
          "org_name",
          "tenant_label",
          "tenant_host",
          "upstream_origin",
          "max_embedded_body_bytes",
          "approved_by_email",
          "approved_at",
          "role",
          "scopes",
          "confirm_by",
          "replaced_key_ids"
        ],
        "properties": {
          "api_key": {
            "type": "string",
            "description": "The raw key, returned exactly once. Never stored by Decionis."
          },
          "key_id": {
            "type": "string",
            "format": "uuid"
          },
          "key_name": {
            "type": "string",
            "examples": [
              "agentsafe-hosted-acme"
            ]
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_name": {
            "type": "string"
          },
          "tenant_label": {
            "type": "string"
          },
          "tenant_host": {
            "type": "string"
          },
          "upstream_origin": {
            "type": "string",
            "format": "uri",
            "description": "The upstream origin the customer approved; the tenant is held to it."
          },
          "max_embedded_body_bytes": {
            "type": "integer",
            "minimum": 0,
            "description": "The request-body embedding limit the customer approved."
          },
          "approved_by_email": {
            "type": "string",
            "format": "email"
          },
          "approved_at": {
            "type": "string",
            "format": "date-time"
          },
          "role": {
            "type": "string",
            "const": "MEMBER"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "const": "decision:shadow"
            },
            "minItems": 1,
            "maxItems": 1
          },
          "confirm_by": {
            "type": "string",
            "format": "date-time",
            "description": "The key expires then unless POST /v1/hosted-gateway/keys/confirm is called with it."
          },
          "replaced_key_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The tenant's earlier keys in this workspace that this key replaces. One that was never delivered is revoked by this redemption; the others stay live until POST /v1/hosted-gateway/keys/confirm with this key revokes them."
          }
        }
      },
      "HostedGatewayDisclosure": {
        "type": "object",
        "required": [
          "statement",
          "evaluated_methods",
          "recorded",
          "json_body_max_bytes",
          "header_values_recorded",
          "never_recorded",
          "key",
          "metering",
          "refusals",
          "disconnect"
        ],
        "properties": {
          "statement": {
            "type": "string",
            "description": "The paragraph the approval page shows verbatim. It states which requests are evaluated and what each records, that each counts as a governed action on the workspace's plan (`metering`), and that Decionis's shadow verdicts never block or change a request while the gateway itself still refuses requests over its rate or size limits or that it cannot read (`refusals`)."
          },
          "evaluated_methods": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "POST",
                "PUT",
                "PATCH",
                "DELETE"
              ]
            ],
            "description": "The methods the gateway evaluates; other requests pass through unrecorded."
          },
          "metering": {
            "type": "string",
            "description": "That each evaluated request counts as one governed action on the workspace's plan (within its allowance or billed as overage)."
          },
          "refusals": {
            "type": "string",
            "description": "What Decionis's verdicts do to a request (nothing, in shadow) and what the gateway itself still refuses (HTTP 429, 413, 400)."
          },
          "recorded": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "method",
                "path",
                "query",
                "json_body",
                "body_sha256",
                "body_bytes",
                "content_type",
                "idempotency_key"
              ]
            }
          },
          "json_body_max_bytes": {
            "type": "integer"
          },
          "header_values_recorded": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "Content-Type",
                "Idempotency-Key"
              ]
            ]
          },
          "never_recorded": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "other request headers",
                "response bodies"
              ]
            ]
          },
          "key": {
            "type": "object",
            "required": [
              "name",
              "role",
              "scopes",
              "power"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "power": {
                "type": "string"
              }
            }
          },
          "disconnect": {
            "type": "string"
          }
        }
      },
      "HostedGatewayWorkspace": {
        "type": "object",
        "required": [
          "org_id",
          "name",
          "role",
          "plan_code",
          "paid",
          "eligible",
          "refusal"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "OWNER",
              "ADMIN",
              "MEMBER",
              "VIEWER"
            ]
          },
          "plan_code": {
            "type": "string"
          },
          "paid": {
            "type": "boolean"
          },
          "eligible": {
            "type": "boolean"
          },
          "refusal": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "HOSTED_GATEWAY_ADMIN_REQUIRED",
              "HOSTED_GATEWAY_PAID_PLAN_REQUIRED",
              "HOSTED_GATEWAY_ENTITLEMENT_INACTIVE",
              null
            ],
            "description": "By the rules the database answers (role, plan, API access); Accounts' entitlement is asked at approval and may still refuse with HOSTED_GATEWAY_ENTITLEMENT_INACTIVE."
          }
        }
      },
      "HostedGatewayLookupRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "user_code"
        ],
        "properties": {
          "user_code": {
            "type": "string",
            "maxLength": 32,
            "examples": [
              "BCDF-GHJK"
            ]
          }
        }
      },
      "HostedGatewayLookup": {
        "type": "object",
        "required": [
          "authorization",
          "disclosure",
          "approver",
          "workspaces",
          "pricing_url"
        ],
        "properties": {
          "authorization": {
            "type": "object",
            "required": [
              "authorization_id",
              "status",
              "user_code",
              "tenant_label",
              "tenant_host",
              "upstream_origin",
              "owner_email",
              "requested_by",
              "requested_at",
              "expires_at",
              "org_id"
            ],
            "properties": {
              "authorization_id": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "approved",
                  "denied",
                  "expired",
                  "consumed"
                ]
              },
              "user_code": {
                "type": "string"
              },
              "tenant_label": {
                "type": "string"
              },
              "tenant_host": {
                "type": "string"
              },
              "upstream_origin": {
                "type": "string"
              },
              "owner_email": {
                "type": "string",
                "description": "In full for the owner; masked (`o***@acme.example`) for anyone else."
              },
              "requested_by": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The operator's sign-in name from their verified Entra token."
                  }
                }
              },
              "requested_at": {
                "type": "string",
                "format": "date-time"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "org_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            }
          },
          "disclosure": {
            "$ref": "#/components/schemas/HostedGatewayDisclosure"
          },
          "approver": {
            "type": "object",
            "required": [
              "email",
              "email_matches",
              "session_org_id"
            ],
            "properties": {
              "email": {
                "type": "string"
              },
              "email_matches": {
                "type": "boolean"
              },
              "session_org_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          "workspaces": {
            "type": "array",
            "description": "The signed-in owner's workspaces; empty for anyone else.",
            "items": {
              "$ref": "#/components/schemas/HostedGatewayWorkspace"
            }
          },
          "pricing_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "HostedGatewayApproveRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "user_code",
          "org_id"
        ],
        "properties": {
          "user_code": {
            "type": "string",
            "maxLength": 32
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "HostedGatewayDenyRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "user_code"
        ],
        "properties": {
          "user_code": {
            "type": "string",
            "maxLength": 32
          }
        }
      },
      "HostedGatewayApproval": {
        "type": "object",
        "required": [
          "status",
          "authorization_id",
          "org_id",
          "org_name",
          "tenant_label",
          "tenant_host",
          "approved_at",
          "session_org_id",
          "session_rebound"
        ],
        "properties": {
          "status": {
            "type": "string",
            "const": "approved"
          },
          "authorization_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_name": {
            "type": "string"
          },
          "tenant_label": {
            "type": "string"
          },
          "tenant_host": {
            "type": "string"
          },
          "approved_at": {
            "type": "string",
            "format": "date-time"
          },
          "session_org_id": {
            "type": "string",
            "format": "uuid"
          },
          "session_rebound": {
            "type": "boolean",
            "description": "True when a new account-session cookie bound to `org_id` was set."
          }
        }
      },
      "HostedGatewayPaidPlanRequired": {
        "type": "object",
        "required": [
          "error",
          "plan_code",
          "pricing_url"
        ],
        "properties": {
          "error": {
            "type": "string",
            "const": "HOSTED_GATEWAY_PAID_PLAN_REQUIRED"
          },
          "message": {
            "type": "string"
          },
          "plan_code": {
            "type": "string"
          },
          "pricing_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "HostedGatewayKeyRevocation": {
        "type": "object",
        "required": [
          "key_id",
          "org_id",
          "tenant_label",
          "revoked_at",
          "revoked_reason"
        ],
        "properties": {
          "key_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_reason": {
            "type": "string",
            "examples": [
              "self_revoked",
              "owner_disconnected"
            ]
          }
        }
      },
      "HostedGatewayDeliveryConfirmation": {
        "type": "object",
        "required": [
          "key_id",
          "org_id",
          "tenant_label",
          "delivered_at",
          "expires_at",
          "already_confirmed",
          "revoked_key_ids"
        ],
        "properties": {
          "key_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_label": {
            "type": "string"
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "null"
          },
          "already_confirmed": {
            "type": "boolean"
          },
          "revoked_key_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The tenant's earlier keys this confirmation revoked (the token answer's `replaced_key_ids` still live); empty when already confirmed."
          }
        }
      },
      "AnalyticsSegment": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "compliance",
          "risk",
          "finance",
          "technical",
          null
        ]
      },
      "AnalyticsEventRequest": {
        "type": "object",
        "required": [
          "experiment",
          "variant",
          "event",
          "visitor_id",
          "page_path",
          "occurred_at"
        ],
        "properties": {
          "experiment": {
            "type": "string",
            "examples": [
              "proof_led_page"
            ]
          },
          "variant": {
            "type": "string",
            "enum": [
              "A",
              "B"
            ]
          },
          "event": {
            "type": "string",
            "examples": [
              "exposure",
              "qualified_demo",
              "signup"
            ]
          },
          "segment": {
            "$ref": "#/components/schemas/AnalyticsSegment"
          },
          "visitor_id": {
            "type": "string"
          },
          "page_path": {
            "type": "string",
            "examples": [
              "/proof-led"
            ]
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "AnalyticsConversionRate": {
        "type": "object",
        "required": [
          "variant",
          "segment",
          "exposed_visitors",
          "converted_visitors",
          "conversion_rate"
        ],
        "properties": {
          "variant": {
            "type": "string",
            "enum": [
              "A",
              "B"
            ]
          },
          "segment": {
            "$ref": "#/components/schemas/AnalyticsSegment"
          },
          "exposed_visitors": {
            "type": "integer",
            "minimum": 0
          },
          "converted_visitors": {
            "type": "integer",
            "minimum": 0
          },
          "conversion_rate": {
            "type": "number",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "AnalyticsExperimentReport": {
        "type": "object",
        "required": [
          "generated_at",
          "experiment",
          "window_days",
          "conversion_event",
          "variants",
          "segments"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "experiment": {
            "type": "string"
          },
          "window_days": {
            "type": "integer"
          },
          "conversion_event": {
            "type": [
              "string",
              "null"
            ]
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnalyticsConversionRate"
            }
          },
          "segments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnalyticsConversionRate"
            }
          }
        },
        "additionalProperties": false
      },
      "ComplianceFrameworkId": {
        "type": "string",
        "enum": [
          "eu_ai_act",
          "gdpr",
          "soc2"
        ]
      },
      "ComplianceEvidencePackRequest": {
        "type": "object",
        "required": [
          "org_id",
          "session_id",
          "workflow_label",
          "window_days",
          "frameworks"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "session_id": {
            "type": "string"
          },
          "workflow_label": {
            "type": "string",
            "examples": [
              "Vendor payments"
            ]
          },
          "window_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          },
          "frameworks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComplianceFrameworkId"
            }
          }
        },
        "additionalProperties": false
      },
      "ComplianceEvidencePackMetrics": {
        "type": "object",
        "required": [
          "decisions",
          "blocked",
          "escalated",
          "human_oversight",
          "recordkeeping"
        ],
        "properties": {
          "decisions": {
            "type": "integer",
            "minimum": 0
          },
          "blocked": {
            "type": "integer",
            "minimum": 0,
            "description": "Decisions with outcome REJECT in ENFORCEMENT mode, refused before the action ran."
          },
          "shadow_blocked": {
            "type": "integer",
            "minimum": 0,
            "description": "Decisions with outcome REJECT in any other mode, recorded while the action went ahead. Absent from packs signed before it was counted."
          },
          "escalated": {
            "type": "integer",
            "minimum": 0
          },
          "human_oversight": {
            "type": "integer",
            "minimum": 0
          },
          "recordkeeping": {
            "type": "integer",
            "minimum": 0,
            "description": "Decisions a stored, signed Decision Dossier backs."
          }
        },
        "additionalProperties": false
      },
      "ComplianceEvidenceControl": {
        "type": "object",
        "required": [
          "ref",
          "name",
          "requirement",
          "evidence",
          "metric_value"
        ],
        "properties": {
          "ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "requirement": {
            "type": "string"
          },
          "evidence": {
            "type": "string"
          },
          "metric": {
            "type": "string",
            "enum": [
              "decisions",
              "blocked",
              "escalated",
              "humanOversight",
              "recordkeeping"
            ]
          },
          "metric_value": {
            "description": "The control's headline count: its metric's value, or for a control with measures (SOC 2) the first measure's. Null where the source is not reported.",
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "measures": {
            "description": "The counts behind a SOC 2 control (CC6.1-CC6.3, CC7.2-CC7.3, CC8.1), each naming the record it is counted from. Null where this deployment has no such record.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComplianceEvidenceMeasure"
            }
          }
        },
        "additionalProperties": false
      },
      "ComplianceEvidenceMeasure": {
        "type": "object",
        "required": [
          "key",
          "label",
          "source",
          "value"
        ],
        "properties": {
          "key": {
            "type": "string",
            "examples": [
              "api_keys_active"
            ]
          },
          "label": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "value": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "ComplianceEvidenceFramework": {
        "type": "object",
        "required": [
          "id",
          "name",
          "controls"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/ComplianceFrameworkId"
          },
          "name": {
            "type": "string"
          },
          "note": {
            "type": "string",
            "description": "What the mapping is and is not (SOC 2 evidence supports an audit; it is not an attestation)."
          },
          "controls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComplianceEvidenceControl"
            }
          }
        },
        "additionalProperties": false
      },
      "ComplianceEvidencePackResponse": {
        "type": "object",
        "required": [
          "pack_id",
          "generated_at",
          "signature",
          "verification_url",
          "metrics",
          "frameworks",
          "download_url"
        ],
        "properties": {
          "pack_id": {
            "type": "string",
            "format": "uuid"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "signature": {
            "type": "string",
            "examples": [
              "ed25519:key-id:base64url-signature"
            ]
          },
          "verification_url": {
            "type": "string",
            "format": "uri"
          },
          "metrics": {
            "$ref": "#/components/schemas/ComplianceEvidencePackMetrics"
          },
          "frameworks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComplianceEvidenceFramework"
            }
          },
          "download_url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      },
      "EvidencePackVerificationResponse": {
        "type": "object",
        "required": [
          "service",
          "verified",
          "valid",
          "checked_at",
          "pack",
          "signature"
        ],
        "properties": {
          "service": {
            "type": "string",
            "enum": [
              "decionis"
            ]
          },
          "verified": {
            "type": "boolean"
          },
          "valid": {
            "type": "boolean"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "pack": {
            "type": "object",
            "additionalProperties": true
          },
          "signature": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "AuthorityClassification": {
        "type": "string",
        "enum": [
          "AUTHORITATIVE",
          "OBSERVATIONAL"
        ],
        "description": "Authority possessed by an artifact, independent of its verdict. Only AUTHORITATIVE artifacts may become execution-eligible."
      },
      "PolicyReference": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "policy_id",
          "revision_id",
          "version",
          "digest"
        ],
        "properties": {
          "policy_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "revision_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      },
      "EvaluationSemantics": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "protocol_version",
          "evaluator_version",
          "policy_schema_version",
          "canonicalization",
          "digest_algorithm",
          "signal_normalization_version"
        ],
        "properties": {
          "protocol_version": {
            "type": "string",
            "const": "1.1"
          },
          "evaluator_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "policy_schema_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "canonicalization": {
            "type": "string",
            "const": "RFC8785/JCS"
          },
          "digest_algorithm": {
            "type": "string",
            "const": "SHA-256"
          },
          "signal_normalization_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        }
      },
      "UcpProtocolVersion": {
        "type": "string",
        "enum": [
          "2026-04-08",
          "2026-08-25"
        ],
        "description": "UCP releases whose checkout response envelopes this adapter validates."
      },
      "UcpCapabilityReference": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "spec": {
            "type": "string",
            "format": "uri",
            "maxLength": 2000
          },
          "schema": {
            "type": "string",
            "format": "uri",
            "maxLength": 2000
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "extends": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "array",
                "minItems": 1,
                "maxItems": 50,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500
                }
              }
            ]
          },
          "config": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "UcpPaymentHandlerReference": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "version",
          "id"
        ],
        "properties": {
          "version": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "spec": {
            "type": "string",
            "format": "uri",
            "maxLength": 2000
          },
          "schema": {
            "type": "string",
            "format": "uri",
            "maxLength": 2000
          },
          "config": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "UcpCheckoutEnvelope": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "$ref": "#/components/schemas/UcpProtocolVersion"
          },
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error"
            ]
          },
          "capabilities": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9_])?)+$"
            },
            "additionalProperties": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "$ref": "#/components/schemas/UcpCapabilityReference"
              }
            },
            "description": "Negotiated UCP capabilities keyed by reverse-domain identifier. A capability is active only through a matching versioned reference; key presence or an empty array is not negotiation."
          },
          "payment_handlers": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9_])?)+$"
            },
            "additionalProperties": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "$ref": "#/components/schemas/UcpPaymentHandlerReference"
              }
            }
          }
        }
      },
      "UcpCheckoutTotal": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "type",
          "amount"
        ],
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "ISO 4217 minor units."
          },
          "display_text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "allOf": [
          {
            "if": {
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "enum": [
                    "discount",
                    "items_discount"
                  ]
                }
              }
            },
            "then": {
              "properties": {
                "amount": {
                  "maximum": -1
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "enum": [
                    "subtotal",
                    "fulfillment",
                    "tax",
                    "fee"
                  ]
                }
              }
            },
            "then": {
              "properties": {
                "amount": {
                  "minimum": 0
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "not": {
                    "enum": [
                      "subtotal",
                      "items_discount",
                      "discount",
                      "fulfillment",
                      "tax",
                      "fee",
                      "total"
                    ]
                  }
                }
              }
            },
            "then": {
              "required": [
                "display_text"
              ]
            }
          }
        ]
      },
      "UcpCheckoutLineItem": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "id",
          "item",
          "quantity",
          "totals"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "item": {
            "type": "object",
            "additionalProperties": true,
            "required": [
              "id",
              "title",
              "price"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 400
              },
              "price": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "ISO 4217 minor units."
              }
            }
          },
          "totals": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/UcpCheckoutTotal"
            }
          }
        }
      },
      "UcpCheckoutLink": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "type",
          "url"
        ],
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2000
          },
          "title": {
            "type": "string",
            "maxLength": 400
          }
        }
      },
      "UcpCheckoutSession": {
        "type": "object",
        "additionalProperties": true,
        "description": "Validated core checkout response plus any negotiated extensions. The seven top-level required members are common to UCP 2026-04-08 and 2026-08-25; the version conditional below additionally requires the August response payment-handler registry.",
        "required": [
          "ucp",
          "id",
          "line_items",
          "status",
          "currency",
          "totals",
          "links"
        ],
        "properties": {
          "ucp": {
            "$ref": "#/components/schemas/UcpCheckoutEnvelope"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "line_items": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/UcpCheckoutLineItem"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "incomplete",
              "requires_escalation",
              "ready_for_complete",
              "complete_in_progress",
              "completed",
              "canceled"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$",
            "description": "ISO 4217 List One code with a numeric minor unit, pinned to the maintenance-agency list published 2026-01-01. Unknown codes and entries whose minor unit is N.A. are rejected before evaluation."
          },
          "totals": {
            "type": "array",
            "minItems": 2,
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/UcpCheckoutTotal"
            },
            "allOf": [
              {
                "contains": {
                  "type": "object",
                  "required": [
                    "type"
                  ],
                  "properties": {
                    "type": {
                      "const": "subtotal"
                    }
                  }
                },
                "minContains": 1,
                "maxContains": 1
              },
              {
                "contains": {
                  "type": "object",
                  "required": [
                    "type"
                  ],
                  "properties": {
                    "type": {
                      "const": "total"
                    }
                  }
                },
                "minContains": 1,
                "maxContains": 1
              }
            ]
          },
          "links": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/UcpCheckoutLink"
            }
          },
          "signals": {
            "type": "object",
            "additionalProperties": true
          },
          "ap2": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "checkout_mandate": {
                "type": "string",
                "maxLength": 8192
              },
              "merchant_authorization": {
                "type": "string",
                "maxLength": 8192
              }
            }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "ucp": {
                  "type": "object",
                  "required": [
                    "version"
                  ],
                  "properties": {
                    "version": {
                      "const": "2026-08-25"
                    }
                  }
                }
              }
            },
            "then": {
              "properties": {
                "ucp": {
                  "required": [
                    "payment_handlers"
                  ]
                }
              }
            }
          }
        ]
      },
      "UcpCheckoutAuthorizeRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "checkout"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional when the authenticated API key is organization-bound."
          },
          "checkout": {
            "$ref": "#/components/schemas/UcpCheckoutSession"
          },
          "agent": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "maxLength": 200
              },
              "human_present": {
                "type": "boolean"
              },
              "environment": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120,
                "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$",
                "description": "Merchant execution environment committed into the signed downstream target, for example base-sepolia or production."
              }
            }
          },
          "approval_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://(?![^/?#]*@)",
            "maxLength": 2000
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ],
            "default": "ENFORCEMENT"
          },
          "grant_ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 180
          },
          "degradation_mode": {
            "type": "string",
            "enum": [
              "fail_closed"
            ],
            "default": "fail_closed",
            "description": "Compatibility field. Execution authority always fails closed; caller-selected fail-open is rejected."
          }
        }
      },
      "UcpMandateVerification": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "verified",
          "status",
          "checked",
          "not_checked"
        ],
        "properties": {
          "verified": {
            "type": "boolean",
            "deprecated": true,
            "description": "Compatibility rollup; use status to distinguish inapplicable from unverified."
          },
          "status": {
            "type": "string",
            "enum": [
              "VERIFIED",
              "UNVERIFIED",
              "NOT_APPLICABLE"
            ]
          },
          "checked": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "not_checked": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "UcpExecutionGrant": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "token",
          "jti",
          "key_id",
          "expires_at",
          "intent_hash",
          "execution_binding_digest",
          "execution_correlation_id",
          "claim_path",
          "finalize_path",
          "intent"
        ],
        "properties": {
          "token": {
            "type": "string"
          },
          "jti": {
            "type": "string"
          },
          "key_id": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "intent_hash": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "execution_binding_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "execution_correlation_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "claim_path": {
            "type": "string",
            "const": "/v1/execution/claim-token"
          },
          "finalize_path": {
            "type": "string",
            "const": "/v1/execution/finalize-token"
          },
          "intent": {
            "$ref": "#/components/schemas/ExecutionIntentBinding"
          }
        }
      },
      "UcpExecutionAuthorityPayloadBase": {
        "type": "object",
        "required": [
          "decision",
          "authoritative",
          "evaluation_id",
          "dossier_id",
          "policy_version",
          "dossier_sha256",
          "reason_codes",
          "required_presence",
          "verification_url",
          "evaluated_at"
        ],
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "ALLOW",
              "ESCALATE",
              "BLOCK"
            ]
          },
          "authoritative": {
            "type": "boolean",
            "description": "Legacy compatibility flag; authority_classification is normative in Protocol 1.1."
          },
          "evaluation_id": {
            "type": "string"
          },
          "dossier_id": {
            "type": "string"
          },
          "policy_version": {
            "type": "string"
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "required_presence": {
            "type": "boolean"
          },
          "verification_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UcpExecutionAuthorityProtocol11Fields": {
        "type": "object",
        "properties": {
          "authority_classification": {
            "$ref": "#/components/schemas/AuthorityClassification"
          },
          "evaluation_mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ]
          },
          "execution_eligible": {
            "type": "boolean"
          },
          "policy_reference": {
            "$ref": "#/components/schemas/PolicyReference"
          },
          "evaluation_semantics": {
            "$ref": "#/components/schemas/EvaluationSemantics"
          },
          "input_snapshot_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "execution_binding_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        },
        "allOf": [
          {
            "if": {
              "required": [
                "authority_classification"
              ],
              "properties": {
                "authority_classification": {
                  "const": "OBSERVATIONAL"
                }
              }
            },
            "then": {
              "properties": {
                "authoritative": {
                  "const": false
                },
                "execution_eligible": {
                  "const": false
                },
                "execution_binding_digest": {
                  "type": "null"
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "execution_eligible"
              ],
              "properties": {
                "execution_eligible": {
                  "const": true
                }
              }
            },
            "then": {
              "required": [
                "authority_classification",
                "evaluation_mode",
                "execution_binding_digest"
              ],
              "properties": {
                "decision": {
                  "const": "ALLOW"
                },
                "authoritative": {
                  "const": true
                },
                "authority_classification": {
                  "const": "AUTHORITATIVE"
                },
                "evaluation_mode": {
                  "const": "ENFORCEMENT"
                },
                "execution_binding_digest": {
                  "type": "string",
                  "pattern": "^sha256:[0-9a-f]{64}$"
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "evaluation_mode"
              ],
              "properties": {
                "evaluation_mode": {
                  "enum": [
                    "SHADOW",
                    "PARALLEL"
                  ]
                }
              }
            },
            "then": {
              "properties": {
                "authority_classification": {
                  "const": "OBSERVATIONAL"
                },
                "execution_eligible": {
                  "const": false
                },
                "execution_binding_digest": {
                  "type": "null"
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "evaluation_mode"
              ],
              "properties": {
                "evaluation_mode": {
                  "const": "ENFORCEMENT"
                }
              }
            },
            "then": {
              "properties": {
                "authoritative": {
                  "const": true
                },
                "authority_classification": {
                  "const": "AUTHORITATIVE"
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "execution_binding_digest"
              ],
              "properties": {
                "execution_binding_digest": {
                  "type": "string"
                }
              }
            },
            "then": {
              "required": [
                "execution_eligible"
              ],
              "properties": {
                "execution_eligible": {
                  "const": true
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "authoritative"
              ],
              "properties": {
                "authoritative": {
                  "const": false
                }
              }
            },
            "then": {
              "properties": {
                "authority_classification": {
                  "const": "OBSERVATIONAL"
                },
                "execution_eligible": {
                  "const": false
                },
                "execution_binding_digest": {
                  "type": "null"
                }
              }
            }
          }
        ]
      },
      "UcpExecutionAuthorityPayloadLegacy": {
        "description": "Exact response projection for extension 2026-09-05.",
        "unevaluatedProperties": false,
        "allOf": [
          {
            "$ref": "#/components/schemas/UcpExecutionAuthorityPayloadBase"
          },
          {
            "type": "object",
            "properties": {
              "dossier_sha256": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          }
        ]
      },
      "UcpExecutionAuthorityPayloadPrevious": {
        "description": "Additive Protocol 1.1 response projection for extension 2026-09-06.",
        "unevaluatedProperties": false,
        "allOf": [
          {
            "$ref": "#/components/schemas/UcpExecutionAuthorityPayloadBase"
          },
          {
            "$ref": "#/components/schemas/UcpExecutionAuthorityProtocol11Fields"
          },
          {
            "type": "object",
            "properties": {
              "dossier_sha256": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^(?:sha256:)?[0-9a-f]{64}$"
              }
            }
          }
        ]
      },
      "UcpExecutionAuthorityPayloadCurrent": {
        "description": "Strict Protocol 1.1 response projection for extension 2026-09-07.",
        "unevaluatedProperties": false,
        "allOf": [
          {
            "$ref": "#/components/schemas/UcpExecutionAuthorityPayloadBase"
          },
          {
            "$ref": "#/components/schemas/UcpExecutionAuthorityProtocol11Fields"
          },
          {
            "type": "object",
            "required": [
              "authority_classification",
              "evaluation_mode",
              "execution_eligible",
              "policy_reference",
              "evaluation_semantics",
              "input_snapshot_digest",
              "execution_binding_digest"
            ],
            "properties": {
              "dossier_sha256": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^sha256:[0-9a-f]{64}$"
              }
            }
          }
        ]
      },
      "UcpExecutionAuthorityPayload": {
        "description": "Version-dispatched response union. The exact negotiated extension release determines which immutable member schema applies; this union preserves historical 2026-09-05 and additive 2026-09-06 responses while making 2026-09-07 Protocol 1.1 evidence strict.",
        "anyOf": [
          {
            "$ref": "#/components/schemas/UcpExecutionAuthorityPayloadLegacy"
          },
          {
            "$ref": "#/components/schemas/UcpExecutionAuthorityPayloadPrevious"
          },
          {
            "$ref": "#/components/schemas/UcpExecutionAuthorityPayloadCurrent"
          }
        ]
      },
      "UcpCheckoutAuthorizeResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "service",
          "ucp"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "ucp": {
            "type": "object",
            "additionalProperties": true,
            "required": [
              "version",
              "status"
            ],
            "properties": {
              "version": {
                "$ref": "#/components/schemas/UcpProtocolVersion"
              },
              "status": {
                "type": "string",
                "enum": [
                  "success",
                  "error"
                ]
              }
            }
          },
          "checkout_id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ]
          },
          "enforcing": {
            "type": "boolean"
          },
          "authority_classification": {
            "$ref": "#/components/schemas/AuthorityClassification"
          },
          "evaluation_mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ],
            "description": "Present on some fail-closed evidence errors; normal results use mode."
          },
          "execution_eligible": {
            "type": "boolean",
            "description": "True only for an AUTHORITATIVE ALLOW carrying an exact-action execution grant. Signature validity alone does not make a response execution-eligible."
          },
          "dossier_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "continue_url": {
            "type": "string",
            "format": "uri"
          },
          "error": {
            "type": "object",
            "additionalProperties": true
          },
          "actions": {
            "$ref": "#/components/schemas/UcpActions"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UcpMessage"
            }
          },
          "fallback": {
            "$ref": "#/components/schemas/UcpAuthorityFallback"
          },
          "com.decionis.commerce.execution_authority": {
            "$ref": "#/components/schemas/UcpExecutionAuthorityPayload"
          },
          "verification": {
            "$ref": "#/components/schemas/UcpMandateVerification"
          },
          "escalation": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "override_id"
                ],
                "properties": {
                  "override_id": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "PENDING",
                      "APPROVED",
                      "REJECTED",
                      "CANCELLED",
                      "EXPIRED"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "execution_grant": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/UcpExecutionGrant"
              },
              {
                "type": "null"
              }
            ]
          },
          "requires_human_approval": {
            "type": "boolean"
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "UcpAuthorityReviewActionConfig": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "continue_url"
        ],
        "properties": {
          "continue_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://(?![^/?#]*@)",
            "maxLength": 2000
          },
          "reason_codes": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UcpAuthorityReviewAction": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "config"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "config": {
            "$ref": "#/components/schemas/UcpAuthorityReviewActionConfig"
          }
        }
      },
      "UcpActions": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "com.decionis.authority.review"
        ],
        "properties": {
          "com.decionis.authority.review": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1,
            "items": {
              "$ref": "#/components/schemas/UcpAuthorityReviewAction"
            }
          }
        }
      },
      "UcpMessage": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "type",
          "content_type",
          "content"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "info",
              "warning",
              "error"
            ]
          },
          "content_type": {
            "type": "string",
            "enum": [
              "plain",
              "markdown"
            ]
          },
          "content": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "UcpAuthorityFallback": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "degraded",
          "mode",
          "reason",
          "circuit_open"
        ],
        "properties": {
          "degraded": {
            "type": "boolean",
            "const": true
          },
          "mode": {
            "type": "string",
            "enum": [
              "fail_closed"
            ]
          },
          "reason": {
            "type": "string"
          },
          "circuit_open": {
            "type": "boolean"
          }
        }
      },
      "UcpPublicEcJwk": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kty",
          "crv",
          "x",
          "y"
        ],
        "properties": {
          "kty": {
            "type": "string",
            "const": "EC"
          },
          "crv": {
            "type": "string",
            "enum": [
              "P-256",
              "P-384",
              "P-521"
            ]
          },
          "x": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "y": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "alg": {
            "type": "string",
            "enum": [
              "ES256",
              "ES384",
              "ES512"
            ]
          },
          "use": {
            "type": "string",
            "maxLength": 20
          }
        }
      },
      "UcpSigningKeyRegistrationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kid",
          "algorithm",
          "public_jwk"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "algorithm": {
            "type": "string",
            "enum": [
              "ES256",
              "ES384",
              "ES512"
            ]
          },
          "public_jwk": {
            "$ref": "#/components/schemas/UcpPublicEcJwk"
          },
          "label": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "UcpSigningKey": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kid",
          "algorithm",
          "label",
          "created_at"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "kid": {
            "type": "string"
          },
          "algorithm": {
            "type": "string",
            "enum": [
              "ES256",
              "ES384",
              "ES512"
            ]
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "UcpSigningKeyListResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "keys"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UcpSigningKey"
            }
          }
        }
      },
      "UcpSigningKeyRevocationResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "kid",
          "revoked"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "kid": {
            "type": "string"
          },
          "revoked": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "ExecutionProviderPublicOkpJwk": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kty",
          "crv",
          "x"
        ],
        "description": "The public half of an Ed25519 key. A `d` member is rejected.",
        "properties": {
          "kty": {
            "type": "string",
            "const": "OKP"
          },
          "crv": {
            "type": "string",
            "const": "Ed25519"
          },
          "x": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "alg": {
            "type": "string",
            "const": "EdDSA"
          },
          "use": {
            "type": "string",
            "const": "sig"
          }
        }
      },
      "ExecutionProviderKeyRegistrationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kid",
          "issuer",
          "algorithm",
          "public_jwk"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional when the authenticated API key is already bound to an organization."
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The `kid` the provider puts in its receipts' protected header."
          },
          "issuer": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The `iss` the provider puts in its receipts or attestations; one under this key with another issuer does not verify."
          },
          "algorithm": {
            "type": "string",
            "const": "EdDSA"
          },
          "public_jwk": {
            "$ref": "#/components/schemas/ExecutionProviderPublicOkpJwk"
          },
          "label": {
            "type": "string",
            "maxLength": 200
          },
          "purpose": {
            "$ref": "#/components/schemas/ExecutionProviderKeyPurpose"
          }
        }
      },
      "ExecutionProviderKey": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "kid",
          "issuer",
          "algorithm",
          "purpose",
          "label",
          "created_at",
          "revoked_at"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "kid": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "algorithm": {
            "type": "string",
            "const": "EdDSA"
          },
          "purpose": {
            "$ref": "#/components/schemas/ExecutionProviderKeyPurpose"
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "PresenceProviderDirectoryEntry": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "provider_id",
          "display_name",
          "issuer",
          "jwks_url",
          "methods",
          "revoked_at"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_.:-]{0,63}$",
            "description": "The id a policy names in verification_requirements.provider."
          },
          "display_name": {
            "type": "string",
            "maxLength": 120
          },
          "issuer": {
            "type": "string",
            "maxLength": 100,
            "description": "The `iss` the provider writes into its attestations."
          },
          "jwks_url": {
            "type": "string",
            "format": "uri",
            "description": "Where the provider publishes its Ed25519 public keys; https only."
          },
          "methods": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "CARD_TAP"
              ]
            }
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "PresenceProviderDirectory": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "providers"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PresenceProviderDirectoryEntry"
            }
          }
        }
      },
      "PresenceProviderAdmission": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "provider_id",
          "display_name",
          "issuer",
          "methods",
          "admitted_at",
          "revoked_at",
          "provider_revoked_at"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "provider_id": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "methods": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "CARD_TAP"
              ]
            }
          },
          "admitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "provider_revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Set when Decionis retired the provider from the directory, whatever the admission says."
          }
        }
      },
      "PresenceProviderAdmissionList": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "admissions"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "admissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PresenceProviderAdmission"
            }
          }
        }
      },
      "ExecutionProviderKeyPurpose": {
        "type": "string",
        "enum": [
          "effect_receipt",
          "presence_attestation",
          "usage_report",
          "signed_signal"
        ],
        "default": "effect_receipt",
        "description": "What the key verifies. A key is only ever used for its own purpose. `usage_report`: an edge installation's monthly usage reports (`POST /v1/edge/usage-reports`); register it with the installation id as `issuer`, which the reports name as `iss`. `signed_signal`: a producer's signed standing signals (`evidence.signals` on enforce-and-bind); register it with the producer id as `issuer`, which the signals name as `iss`."
      },
      "ExecutionProviderKeyListResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "keys"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionProviderKey"
            }
          }
        }
      },
      "ExecutionProviderKeyRevocationResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "kid",
          "revoked"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "kid": {
            "type": "string"
          },
          "revoked": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "GovernedPlan": {
        "type": "object",
        "additionalProperties": false,
        "description": "`agent-safe.plan/1`, as AgentSafe defines it (ADR 0008): its digest is\nSHA-256 over the plan's RFC 8785 form. Edges join known, distinct steps\nonce and form no cycle; a compensation step stands outside the edges and\ncompensates ordinary steps only.\n",
        "required": [
          "version",
          "plan_id",
          "tenant_id",
          "steps",
          "edges",
          "partial_commit"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "agent-safe.plan/1"
          },
          "plan_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]*$"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "steps": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/GovernedPlanStep"
            }
          },
          "edges": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/GovernedPlanEdge"
            }
          },
          "partial_commit": {
            "type": "object",
            "additionalProperties": false,
            "description": "What stays admissible once a step has FAILED: the listed steps, if\ntheir edges allow it; every other remaining step takes `otherwise`.\n",
            "required": [
              "admissible",
              "otherwise"
            ],
            "properties": {
              "admissible": {
                "type": "array",
                "maxItems": 32,
                "items": {
                  "$ref": "#/components/schemas/GovernedPlanStepId"
                }
              },
              "otherwise": {
                "type": "string",
                "enum": [
                  "ESCALATE",
                  "BLOCK"
                ]
              }
            }
          }
        }
      },
      "GovernedPlanStepId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^[a-z][a-z0-9_-]*$"
      },
      "GovernedPlanStep": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step_id",
          "action",
          "target"
        ],
        "properties": {
          "step_id": {
            "$ref": "#/components/schemas/GovernedPlanStepId"
          },
          "action": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "pattern": "^[a-z][a-z0-9._:-]*$"
          },
          "target": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "An exact resource, or a prefix followed by one trailing `*`."
          },
          "parameters": {
            "type": "object",
            "additionalProperties": true,
            "description": "Parameters the step pins; each must equal the intent's, canonically."
          },
          "compensates": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "description": "Present only on a compensation step: it is admissible only after one\nof these steps FAILED, and never otherwise. It still needs its own\ngrant.\n",
            "items": {
              "$ref": "#/components/schemas/GovernedPlanStepId"
            }
          }
        }
      },
      "GovernedPlanEdge": {
        "type": "object",
        "additionalProperties": false,
        "description": "`to` depends on `from`. `ordered`: `to` waits for `from` to commit with\na confirmed effect, and is refused after it failed. `all_or_escalate`:\nthe same wait, and a person decides after it failed. `independent`:\n`from`'s outcome changes nothing for `to`.\n",
        "required": [
          "from",
          "to",
          "coupling"
        ],
        "properties": {
          "from": {
            "$ref": "#/components/schemas/GovernedPlanStepId"
          },
          "to": {
            "$ref": "#/components/schemas/GovernedPlanStepId"
          },
          "coupling": {
            "type": "string",
            "enum": [
              "independent",
              "ordered",
              "all_or_escalate"
            ]
          }
        }
      },
      "GovernedPlanRegistration": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "plan_id",
          "plan_digest",
          "registered_at",
          "authorizes"
        ],
        "properties": {
          "plan_id": {
            "type": "string"
          },
          "plan_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "registered_at": {
            "type": "string",
            "format": "date-time"
          },
          "authorizes": {
            "type": "string",
            "const": "NOTHING",
            "description": "Registering a plan grants no step; each is decided and granted on its own."
          }
        }
      },
      "GovernedPlanStatus": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "plan_id",
          "plan_digest",
          "registered_at",
          "state",
          "scitt_outcome_state",
          "steps",
          "plan"
        ],
        "properties": {
          "plan_id": {
            "type": "string"
          },
          "plan_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "registered_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PARTIAL",
              "SUSPENDED",
              "COMPLETE"
            ]
          },
          "scitt_outcome_state": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "partially_completed",
              "pending_confirmation",
              "completed",
              null
            ]
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "step_id",
                "status"
              ],
              "properties": {
                "step_id": {
                  "$ref": "#/components/schemas/GovernedPlanStepId"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "IN_FLIGHT",
                    "COMMITTED",
                    "UNCONFIRMED",
                    "INDETERMINATE",
                    "FAILED"
                  ]
                }
              }
            }
          },
          "plan": {
            "$ref": "#/components/schemas/GovernedPlan"
          }
        }
      },
      "AuthorityAllowanceKey": {
        "type": "string",
        "description": "The name a policy rule's `then.allowance.key` draws on, unique within the organisation.",
        "pattern": "^[a-z0-9][a-z0-9._:-]{0,127}$"
      },
      "AuthorityAllowanceRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "unit",
          "limit",
          "window_seconds"
        ],
        "properties": {
          "unit": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]*$",
            "description": "What one unit counts (replicas, deployments, USD_minor); a label only."
          },
          "limit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "The most the allowance admits across its window."
          },
          "window_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 60,
            "maximum": 31536000,
            "description": "A rolling window over which committed draws count. Null means no window: a committed draw counts until the limit is raised past it."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          }
        }
      },
      "AuthorityAllowanceUsage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reserved",
          "held",
          "consumed",
          "available"
        ],
        "properties": {
          "reserved": {
            "type": "integer",
            "minimum": 0,
            "description": "Reserved by grants not yet claimed and not yet expired."
          },
          "held": {
            "type": "integer",
            "minimum": 0,
            "description": "Held by claims whose outcome is open (CLAIMED) or unknown (INDETERMINATE)."
          },
          "consumed": {
            "type": "integer",
            "minimum": 0,
            "description": "Kept by committed claims within the window."
          },
          "available": {
            "type": "integer",
            "minimum": 0,
            "description": "The limit less reserved, held and consumed; never below zero."
          }
        }
      },
      "AuthorityAllowance": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "allowance_key",
          "unit",
          "limit",
          "window_seconds",
          "description",
          "usage",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "allowance_key": {
            "$ref": "#/components/schemas/AuthorityAllowanceKey"
          },
          "unit": {
            "type": "string"
          },
          "limit": {
            "type": "integer",
            "minimum": 0
          },
          "window_seconds": {
            "type": [
              "integer",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/AuthorityAllowanceUsage"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AuthorityAllowanceListResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "allowances"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "decionis"
          },
          "allowances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuthorityAllowance"
            }
          }
        }
      },
      "DecisionStatus": {
        "type": "string",
        "enum": [
          "ALLOW",
          "BLOCK",
          "ESCALATE",
          "REVIEW_REQUIRED",
          "ERROR"
        ]
      },
      "Actor": {
        "type": "object",
        "required": [
          "id",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "examples": [
              "AI_AGENT",
              "TRADING_BOT",
              "HUMAN",
              "SERVICE"
            ]
          },
          "role": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "Action": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "examples": [
              "TRANSFER_FUNDS",
              "OPEN_POSITION"
            ]
          },
          "resource": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "DecisionRequest": {
        "type": "object",
        "required": [
          "tenant_id",
          "actor",
          "action"
        ],
        "properties": {
          "tenant_id": {
            "type": "string"
          },
          "actor": {
            "$ref": "#/components/schemas/Actor"
          },
          "action": {
            "$ref": "#/components/schemas/Action"
          },
          "context": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "signals": {
                "type": "object",
                "additionalProperties": true,
                "description": "Signal values may be existing scalars, legacy\n`{value, source?, observed_at?}` envelopes, or a strict\nSemanticSignalEnvelope. Typed values are digest-checked and\nadmitted by the selected policy bundle before rules can use them.\n"
              }
            }
          },
          "policy_refs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "idempotency_key": {
            "type": "string"
          },
          "correlation_id": {
            "type": "string"
          },
          "shadow_mode": {
            "type": "boolean",
            "default": false
          },
          "enforcement_mode": {
            "type": "string",
            "enum": [
              "enforce",
              "shadow",
              "dry_run"
            ],
            "default": "enforce"
          }
        },
        "additionalProperties": true
      },
      "ExecutionIntentActor": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "runtime": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "trust_level": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        }
      },
      "ExecutionIntentAction": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "resource",
          "parameters"
        ],
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "pattern": "^[a-z][a-z0-9._:-]*$"
          },
          "resource": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "parameters": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ExecutionDownstreamTarget": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "system",
          "operation"
        ],
        "properties": {
          "system": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "environment": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "default": "production"
          },
          "endpoint": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        }
      },
      "ExecutionPolicyProjection": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "decision_type",
          "transaction_type",
          "workflow_key",
          "channel"
        ],
        "description": "Exact policy-routing vocabulary committed into the intent. Protocol adapters use it when their evaluated decision type differs from the executable action type; legacy generic callers may omit it.",
        "properties": {
          "decision_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "transaction_type": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 120
          },
          "workflow_key": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 120
          },
          "channel": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 120
          }
        }
      },
      "ExecutionIntentBindingBase": {
        "type": "object",
        "required": [
          "protocol_version",
          "tenant_id",
          "intent_id",
          "captured_at",
          "expires_at",
          "actor",
          "action",
          "context",
          "downstream_target"
        ],
        "properties": {
          "protocol_version": {
            "type": "string",
            "const": "agent-safe.intent/1"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "intent_id": {
            "type": "string",
            "format": "uuid"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Must be later than captured_at and no more than five minutes after it."
          },
          "actor": {
            "$ref": "#/components/schemas/ExecutionIntentActor"
          },
          "action": {
            "$ref": "#/components/schemas/ExecutionIntentAction"
          },
          "context": {
            "type": "object",
            "additionalProperties": true,
            "description": "The trusted runtime's context, entirely inside the canonical intent hash. Open by design, with four reserved keys. `idempotency_key` is required and carries the retry identity. `enforcement_boundary` and `workload` are what an enforcement boundary reports about itself and about the software that proposed the action; each is validated against its schema when present, and an absent signal is an answer rather than a placeholder, so a policy that requires provenance refuses on its absence. `agent_safe` is what the runtime states about the action's own circumstances; Decionis reads only the sub-keys named here, each validated when present, into the facts it writes under the same name. `runtime_attribution` is reserved for Decionis, which computes it from those reports, and a request that supplies it is refused.",
            "properties": {
              "enforcement_boundary": {
                "$ref": "#/components/schemas/EnforcementBoundarySignal"
              },
              "workload": {
                "$ref": "#/components/schemas/WorkloadSignal"
              },
              "agent_safe": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "precondition": {
                    "$ref": "#/components/schemas/ExecutionTargetPrecondition"
                  }
                }
              }
            }
          },
          "downstream_target": {
            "$ref": "#/components/schemas/ExecutionDownstreamTarget"
          },
          "policy_projection": {
            "$ref": "#/components/schemas/ExecutionPolicyProjection"
          },
          "expected_effect_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "Digest-only commitment to the expected downstream state. Part of the hashed intent, so the authority never adds one. A Protocol 1.1 grant bound without it accepts no effect evidence at finalization or reconciliation (EFFECT_EXPECTED_BINDING_UNAVAILABLE), and the grant is issued with `x-decionis-warning: EXPECTED_EFFECT_DIGEST_MISSING`."
          }
        }
      },
      "EnforcementBoundarySignal": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "boundary_id",
          "agentsafe_version",
          "protocol_version",
          "deployment_type"
        ],
        "description": "Which enforcement boundary admitted the intent. The identity is of the configured logical boundary, not of the process running it: a restart, a rescheduling or a scale-out leaves it unchanged, and the container, pod and node are deliberately absent, so an effect's evidence names the door rather than whichever instance was alive at the time.",
        "properties": {
          "boundary_id": {
            "type": "string",
            "maxLength": 200,
            "description": "What the operator calls this boundary, or a stable id derived from its configuration."
          },
          "agentsafe_version": {
            "type": "string",
            "maxLength": 80
          },
          "protocol_version": {
            "type": "string",
            "const": "agent-safe.intent/1"
          },
          "deployment_type": {
            "type": "string",
            "maxLength": 200,
            "description": "What the boundary was installed as, for example docker, kubernetes or linux."
          },
          "environment": {
            "type": "string",
            "maxLength": 200
          },
          "conformance_version": {
            "type": "string",
            "maxLength": 120
          },
          "placement": {
            "type": "object",
            "additionalProperties": false,
            "description": "Stable placement only. It survives a restart and is what a policy means by an environment and a region.",
            "properties": {
              "cluster_id": {
                "type": "string",
                "maxLength": 200
              },
              "namespace": {
                "type": "string",
                "maxLength": 200
              },
              "region": {
                "type": "string",
                "maxLength": 200
              },
              "workload_id": {
                "type": "string",
                "maxLength": 200
              }
            }
          }
        }
      },
      "WorkloadSignal": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "provenance"
        ],
        "description": "What software proposed the action, as a runtime reported it. Decionis records the report and does not establish it: image digests, provenance attestations and publisher verification belong to the container and OCI tooling that produced them. Every field is optional but `provenance`, because a workload cannot be expressed without saying who reported it and how far that report goes.",
        "properties": {
          "runtime": {
            "type": "string",
            "maxLength": 200
          },
          "artifact_type": {
            "type": "string",
            "maxLength": 200
          },
          "image": {
            "type": "string",
            "maxLength": 500
          },
          "digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "publisher": {
            "type": "string",
            "maxLength": 200
          },
          "provenance": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "source",
              "trust_level"
            ],
            "properties": {
              "source": {
                "type": "string",
                "maxLength": 200,
                "description": "Who reported it, for example docker, kubernetes or operator."
              },
              "trust_level": {
                "type": "string",
                "enum": [
                  "unverified",
                  "supplied",
                  "observed",
                  "verified"
                ],
                "description": "How far the producer said its report goes. It is the producer's claim, recorded as such: Decionis neither raises nor lowers it. A policy that means the platform checked something matches on the decision's `runtime_attribution.platform_verified` instead, which Decionis computes and a caller cannot assert."
              }
            }
          }
        }
      },
      "ExecutionTargetPrecondition": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "source",
          "read_at"
        ],
        "description": "The target's state as the trusted runtime read it immediately before asking: the version the decision is made against, inside the intent hash. Policy reads it as `agent_safe.precondition` (a transition rule reads its `state`), the grant binds `version` as `binding.expected_state_version`, and the claim's attestation carries it to a verifying provider, which effects only while the target is still at that version and otherwise refuses `TARGET_STATE_CHANGED`. Revalidation at the claim catches a policy or a signal that changed; this catches a target that changed underneath an unchanged policy. A malformed precondition is refused with `INTENT_PRECONDITION_INVALID`.",
        "properties": {
          "version": {
            "type": "string",
            "pattern": "^[\\x21-\\x7e]{1,256}$",
            "description": "Opaque, compared byte for byte, as a strong `If-Match` compares: an entity tag keeps its quotes and its `W/`, a resource version is its decimal string."
          },
          "state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The target's state as the read named it, when it names one."
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.:/#-]*$",
            "description": "Which read produced it: `<profile>#<operation>` for an API profile, or the executor's own name for its read."
          },
          "read_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ExecutionIntentBinding": {
        "unevaluatedProperties": false,
        "allOf": [
          {
            "$ref": "#/components/schemas/ExecutionIntentBindingBase"
          }
        ]
      },
      "PresenceHumanApprovalEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "provider",
          "requestId",
          "receiptDossierId"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "const": "presence"
          },
          "requestId": {
            "type": "string",
            "maxLength": 200
          },
          "receiptDossierId": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "AttestedHumanApprovalEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "A presence provider's signed attestation that a person was present for this exact intent (for example, the cardholder tapping their own card), as a compact JWS whose payload is PresenceAttestationClaims.",
        "required": [
          "provider",
          "attestation"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "const": "attestation"
          },
          "attestation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000,
            "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"
          }
        }
      },
      "HumanApprovalEvidence": {
        "description": "A Presence receipt (bank-designated roles, verified with Presence) or a presence provider's attestation (verified against the key the organisation registered for it). Either is evidence for a fresh policy evaluation, never authority by itself.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/PresenceHumanApprovalEvidence"
          },
          {
            "$ref": "#/components/schemas/AttestedHumanApprovalEvidence"
          }
        ],
        "discriminator": {
          "propertyName": "provider",
          "mapping": {
            "presence": "#/components/schemas/PresenceHumanApprovalEvidence",
            "attestation": "#/components/schemas/AttestedHumanApprovalEvidence"
          }
        }
      },
      "PresenceAttestationClaims": {
        "type": "object",
        "description": "The payload of a presence attestation. The provider signs it with a key the organisation registered at `/v1/execution/provider-keys` with purpose `presence_attestation`, protected header `alg` EdDSA, `typ` `decionis-presence-attestation+jwt` and `kid`. Decionis verifies the signature under that key, requires `iss` to be the issuer registered with it (and never `presence`), `aud` to be the organisation (the request's `tenant_id`), `exp` to be in the future and at most 300 seconds after `iat` (300 s clock tolerance), `intent_id` and `intent_hash` to be the request's, so a proof for one action cannot be replayed onto another, and `presence.result` to be VERIFIED. `sub` and `card_token_ref` are opaque references, never a card number.",
        "additionalProperties": true,
        "required": [
          "iss",
          "aud",
          "sub",
          "iat",
          "exp",
          "jti",
          "intent_id",
          "intent_hash",
          "presence"
        ],
        "properties": {
          "iss": {
            "type": "string",
            "maxLength": 100,
            "description": "The provider id, equal to the issuer registered with the key."
          },
          "aud": {
            "type": "string",
            "format": "uuid",
            "description": "The organisation id the attestation is for."
          },
          "sub": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Opaque subject reference, e.g. a card token reference. Never a PAN."
          },
          "iat": {
            "type": "integer"
          },
          "exp": {
            "type": "integer"
          },
          "jti": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The attestation's unique id."
          },
          "intent_id": {
            "type": "string",
            "format": "uuid"
          },
          "intent_hash": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "presence": {
            "type": "object",
            "additionalProperties": true,
            "required": [
              "method",
              "result",
              "approver_role"
            ],
            "properties": {
              "method": {
                "type": "string",
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9_.:-]*$",
                "description": "How presence was proven, e.g. `card_tap`."
              },
              "result": {
                "type": "string",
                "enum": [
                  "VERIFIED",
                  "FAILED"
                ]
              },
              "approver_role": {
                "type": "string",
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9_.:-]*$",
                "description": "Who proved presence, e.g. `cardholder`."
              },
              "card_token_ref": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "token_match": {
                "type": "boolean"
              },
              "network_validated": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "PresenceAttestationRefusal": {
        "type": "object",
        "additionalProperties": false,
        "description": "A presence attestation that did not verify; no evaluation ran.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "PRESENCE_ATTESTATION_MALFORMED",
              "PRESENCE_ATTESTATION_KEY_UNKNOWN",
              "PRESENCE_ATTESTATION_SIGNATURE_INVALID",
              "PRESENCE_ATTESTATION_EXPIRED",
              "PRESENCE_ATTESTATION_AUDIENCE_MISMATCH",
              "PRESENCE_ATTESTATION_INTENT_MISMATCH",
              "PRESENCE_ATTESTATION_ISSUER_MISMATCH",
              "PRESENCE_ATTESTATION_NOT_VERIFIED"
            ]
          }
        }
      },
      "SignedSignalEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "A producer's signed standing signal about the subject (for example, the cardholder's Tap to Authenticate granting an agent permission to buy on their behalf, within limits, until a date), as a compact JWS whose payload is SignedSignalClaims.",
        "required": [
          "token"
        ],
        "properties": {
          "token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000,
            "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"
          }
        }
      },
      "SignedSignalClaims": {
        "type": "object",
        "description": "The payload of a signed producer signal. The producer signs it with a key the organisation registered at `/v1/execution/provider-keys` with purpose `signed_signal` (or one an admitted presence provider publishes in its JWKS), protected header `alg` EdDSA, `typ` `decionis-signed-signal+jwt` and `kid`. Decionis verifies the signature under that key, requires `iss` to be the issuer registered with it (and never `presence`), `aud` to be the organisation (the request's `tenant_id`), `exp` to be in the future and at most 2592000 seconds (thirty days) after `iat` (300 s clock tolerance), and `signal.result` to be VERIFIED. The signal binds no intent: it stands, and is presented with every intent it is meant to cover; what it asserts is compared with each intent and recorded as `covers`. `sub` and `card_token_ref` are opaque references, never a card number. `signal` is closed: a key outside those listed is malformed.",
        "additionalProperties": true,
        "required": [
          "iss",
          "aud",
          "sub",
          "iat",
          "exp",
          "jti",
          "signal"
        ],
        "properties": {
          "iss": {
            "type": "string",
            "maxLength": 100,
            "description": "The producer id, equal to the issuer registered with the key."
          },
          "aud": {
            "type": "string",
            "format": "uuid",
            "description": "The organisation id the signal is for."
          },
          "sub": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Opaque subject reference, e.g. a cardholder or card token reference. Never a PAN."
          },
          "iat": {
            "type": "integer"
          },
          "exp": {
            "type": "integer"
          },
          "jti": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The signal's unique id, recorded as `signal_id`."
          },
          "signal": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "method",
              "result"
            ],
            "properties": {
              "name": {
                "type": "string",
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                "description": "The fact name the signal is written under, e.g. `card_delegation`."
              },
              "method": {
                "type": "string",
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9_.:-]*$",
                "description": "How the producer established it, e.g. `card_tap`."
              },
              "result": {
                "type": "string",
                "enum": [
                  "VERIFIED",
                  "FAILED"
                ]
              },
              "agent": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "The actor the permission is for; compared with the intent's `actor.id` (`covers.agent`)."
              },
              "scope": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "actions"
                ],
                "description": "The action types permitted; compared with the intent's `action.type` (`covers.action`).",
                "properties": {
                  "actions": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 32,
                    "items": {
                      "type": "string",
                      "maxLength": 120,
                      "pattern": "^[a-z][a-z0-9._:-]*$"
                    }
                  }
                }
              },
              "limits": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "currency",
                  "amount_minor"
                ],
                "properties": {
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{3}$",
                    "description": "Normalised to upper case; compared with `action.parameters.currency` (`covers.currency`)."
                  },
                  "amount_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The ceiling in minor units; `action.parameters.amountMinor` must not exceed it (`covers.amount`)."
                  }
                }
              },
              "card_token_ref": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "The card the permission is for; compared with `action.parameters.cardTokenRef` or a `card:` resource (`covers.card`). Never a PAN."
              }
            }
          }
        }
      },
      "SignedSignalRefusal": {
        "type": "object",
        "additionalProperties": false,
        "description": "A signed signal that did not verify; no evaluation ran and no event fired.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "SIGNED_SIGNAL_MALFORMED",
              "SIGNED_SIGNAL_KEY_UNKNOWN",
              "SIGNED_SIGNAL_SIGNATURE_INVALID",
              "SIGNED_SIGNAL_EXPIRED",
              "SIGNED_SIGNAL_AUDIENCE_MISMATCH",
              "SIGNED_SIGNAL_ISSUER_MISMATCH",
              "SIGNED_SIGNAL_NOT_VERIFIED",
              "SIGNED_SIGNAL_DUPLICATE_NAME"
            ]
          }
        }
      },
      "ManagedEscalationApproverConstraints": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "principal_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "role_id": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]{1,63}$"
          }
        },
        "anyOf": [
          {
            "required": [
              "principal_id"
            ]
          },
          {
            "required": [
              "role_id"
            ]
          }
        ],
        "description": "Optional narrowing constraints. These values do not assign a role; effective identity and role are resolved from trusted tenant identity configuration and verified Presence evidence."
      },
      "ManagedEscalationVerificationRequirements": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "methods"
        ],
        "properties": {
          "methods": {
            "type": "array",
            "minItems": 1,
            "maxItems": 3,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "WEBAUTHN",
                "ACTIVE_LIVENESS"
              ]
            }
          },
          "level": {
            "type": "string",
            "enum": [
              "STANDARD",
              "HIGH_CONFIDENCE"
            ]
          }
        },
        "description": "Optional equal-or-stronger constraints applied to the policy-issued AuthorityRequirement. They can never downgrade policy requirements."
      },
      "ManagedEscalationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "const": "MANAGED"
          },
          "approver": {
            "$ref": "#/components/schemas/ManagedEscalationApproverConstraints"
          },
          "verification_requirements": {
            "$ref": "#/components/schemas/ManagedEscalationVerificationRequirements"
          }
        },
        "description": "Requests Decionis-owned Presence orchestration. This object is outside the canonical ExecutionIntentBinding hash and is included in request replay validation. It is valid only in ENFORCEMENT mode."
      },
      "ManagedEscalationLifecycleStatus": {
        "type": "string",
        "enum": [
          "PENDING_PRESENCE",
          "PRESENCE_REQUESTED",
          "AWAITING_APPROVER",
          "PRESENCE_VERIFIED",
          "REAUTHORIZING",
          "GRANT_READY",
          "EXPIRED",
          "REJECTED",
          "BLOCKED",
          "CANCELLED",
          "FAILED"
        ]
      },
      "ManagedEscalationOutcome": {
        "type": "string",
        "enum": [
          "ESCALATE_PENDING",
          "ALLOW",
          "BLOCK",
          "ERROR"
        ]
      },
      "ManagedEscalationReference": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "outcome",
          "escalation_id",
          "intent_id",
          "status",
          "expires_at",
          "reason_codes"
        ],
        "properties": {
          "outcome": {
            "$ref": "#/components/schemas/ManagedEscalationOutcome"
          },
          "escalation_id": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "intent_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/ManagedEscalationLifecycleStatus"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason_codes": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string"
            }
          }
        },
        "description": "Non-authorizing status locator. It is not an ExecutionBinding, claim token, invitation, or executable capability."
      },
      "ManagedEscalationStatus": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "escalation_id",
          "intent_id",
          "action_hash",
          "status",
          "outcome",
          "expires_at",
          "reason_codes",
          "decision"
        ],
        "properties": {
          "escalation_id": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "intent_id": {
            "type": "string",
            "format": "uuid"
          },
          "action_hash": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "status": {
            "$ref": "#/components/schemas/ManagedEscalationLifecycleStatus"
          },
          "outcome": {
            "$ref": "#/components/schemas/ManagedEscalationOutcome"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason_codes": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string"
            }
          },
          "decision": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExecutionAuthorityDecision"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ManagedEscalationApproval": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "escalation_id",
          "status",
          "provider",
          "authority_request_id",
          "expires_at"
        ],
        "properties": {
          "escalation_id": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "status": {
            "$ref": "#/components/schemas/ManagedEscalationLifecycleStatus"
          },
          "provider": {
            "type": "string",
            "enum": [
              "presence"
            ]
          },
          "authority_request_id": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^aur_[0-9a-f]{24}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PresenceAuthorityCompletion": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "org_id",
          "authority_request_id",
          "source_decision_id",
          "requirement_digest",
          "action_digest",
          "proof_digest",
          "proof_dossier_id",
          "verified_at",
          "expires_at"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "presence.authority_completion/1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "authority_request_id": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "source_decision_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "requirement_digest": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "action_digest": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "proof_digest": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "proof_dossier_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ExecutionAuthorityRequest": {
        "unevaluatedProperties": false,
        "allOf": [
          {
            "$ref": "#/components/schemas/ExecutionIntentBindingBase"
          },
          {
            "type": "object",
            "required": [
              "intent_hash",
              "mode"
            ],
            "properties": {
              "intent_hash": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$",
                "description": "SHA-256 of the UTF-8 canonical JSON ExecutionIntentBinding.\nObjects are recursively key-sorted using ECMAScript's default\nUTF-16 code-unit ordering and serialized with JSON.stringify semantics.\n"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "SHADOW",
                  "PARALLEL",
                  "ENFORCEMENT"
                ]
              },
              "escalation": {
                "$ref": "#/components/schemas/ManagedEscalationRequest"
              },
              "executor": {
                "$ref": "#/components/schemas/AuthorityExecutor"
              },
              "evidence": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "humanApproval": {
                    "$ref": "#/components/schemas/HumanApprovalEvidence"
                  },
                  "signals": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "description": "Producers' signed standing signals about the subject, each verified against the producer's registered key (purpose `signed_signal`) or an admitted presence provider's JWKS, and written as facts under `agent_safe.signed_signals`. Bound to no intent; presented with or without a human approval, in any mode. Two under one `signal.name` are refused.",
                    "items": {
                      "$ref": "#/components/schemas/SignedSignalEvidence"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "ExecutionAuthorityDecision": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "decision_id",
          "chain_id",
          "status",
          "should_execute",
          "authority_classification",
          "execution_eligible",
          "execution_binding_digest",
          "reason_codes",
          "action_hash",
          "policy_version",
          "mode",
          "execution_token",
          "execution_token_jti",
          "execution_token_key_id",
          "execution_token_expires_at",
          "dossier_id",
          "dossier_sha256",
          "dossier_url",
          "approval_request_id",
          "ledger_entry_id"
        ],
        "properties": {
          "decision_id": {
            "type": "string"
          },
          "chain_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ALLOW",
              "BLOCK",
              "ESCALATE",
              "REVIEW_REQUIRED",
              "ERROR"
            ]
          },
          "should_execute": {
            "type": "boolean"
          },
          "authority_classification": {
            "$ref": "#/components/schemas/AuthorityClassification"
          },
          "execution_eligible": {
            "type": "boolean",
            "description": "True only for an AUTHORITATIVE ALLOW carrying an exact-action ExecutionBinding and executable grant."
          },
          "execution_binding_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "action_hash": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "policy_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT",
              null
            ]
          },
          "execution_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "Present only when status is ALLOW and should_execute is true."
          },
          "execution_token_jti": {
            "type": [
              "string",
              "null"
            ],
            "description": "Single-use identifier of the issued execution token."
          },
          "execution_token_key_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the key that signed the issued execution token."
          },
          "execution_token_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dossier_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "dossier_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "dossier_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "approval_request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "managed_escalation": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ManagedEscalationReference"
              },
              {
                "type": "null"
              }
            ]
          },
          "verification": {
            "$ref": "#/components/schemas/DecisionDossierVerificationEnvelope",
            "description": "Present only for a client that identifies itself as agent-safe-pipeline/0.2.0 or later, or as govern/2.0.0 or later; absent for every other client."
          },
          "escalation_requirement": {
            "$ref": "#/components/schemas/EscalationRequirement",
            "description": "Present only on an ESCALATE, and only for a client that identifies itself as agent-safe-pipeline/0.3.7 or later; absent for every other client. Routing, never authority."
          },
          "permit_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present only when the request named a `permit` executor and a grant was issued: the grant's jti (`execution_token_jti`), the `{grantId}` of `/v1/authority/grants/{grantId}`."
          },
          "intent_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Present with `permit_id`: the intent hash (`action_hash`) as bare lowercase hex, written as `dossier_sha256` is."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Present with `permit_id`: when the grant stops being claimable (`execution_token_expires_at`)."
          }
        }
      },
      "AuthorityExecutor": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "platform",
          "style",
          "version"
        ],
        "description": "Who will carry out a granted action, and how it takes authority: a `dispatch` executor presents the execution token at the claim; a `permit` executor runs inside a platform that holds a single-use permit and reports its own native receipt. Delivery information only: never part of the canonical intent, its hash, or the grant's binding, and it changes nothing about the decision.",
        "properties": {
          "platform": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z0-9][a-z0-9._-]*$"
          },
          "style": {
            "type": "string",
            "enum": [
              "dispatch",
              "permit"
            ]
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[0-9A-Za-z][0-9A-Za-z.+_-]*$"
          }
        }
      },
      "EscalationRequirement": {
        "type": "object",
        "additionalProperties": false,
        "description": "Where an ESCALATE goes: which authority the policy requires (its kind and role, never a person) and who proves that person, by which method. The runtime holding the intent hands the cardholder's tap to the provider named here and resumes with the attestation; a bank role goes to Decionis Presence. Only a fresh evaluation with the proof as evidence can turn the hold into a grant.",
        "required": [
          "requirement_id",
          "expires_at",
          "selector",
          "verification"
        ],
        "properties": {
          "requirement_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The issued Presence requirement's id when one was issued (a managed escalation); null for a direct one."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "selector": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ROLE",
                      "PRINCIPAL"
                    ]
                  },
                  "role_id": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "verification": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "provider",
                  "methods",
                  "level"
                ],
                "properties": {
                  "provider": {
                    "type": "string",
                    "description": "`decionis` for Decionis Presence; otherwise the admitted presence provider's id."
                  },
                  "methods": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "WEBAUTHN",
                        "MOBILE_DEVICE",
                        "ACTIVE_LIVENESS",
                        "CARD_TAP"
                      ]
                    }
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "HIGH_CONFIDENCE"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "DecisionDossierVerificationEnvelope": {
        "type": "object",
        "description": "The share-safe way to verify a Decision Dossier without an account: a page and an API URL carrying an expiring share-link capability (`?sig=`, `&exp=`) that gates access, and the pointers to the Ed25519 proof that establishes authenticity. The capability is an access gate, never proof; the signatures in the proof bundle are the proof.",
        "required": [
          "verification_page_url",
          "verification_url",
          "signature"
        ],
        "properties": {
          "verification_page_url": {
            "type": "string",
            "format": "uri",
            "description": "The public page that runs the verification for anyone who opens it."
          },
          "verification_url": {
            "type": "string",
            "format": "uri",
            "description": "The public verify route, `/v1/public/decision-dossiers/{dossier_id}/verify`, with its capability."
          },
          "verification_api_path": {
            "type": "string"
          },
          "signature": {
            "type": "string"
          },
          "signature_algorithm": {
            "type": "string",
            "examples": [
              "HMAC-SHA256"
            ]
          },
          "signature_scheme": {
            "type": "string",
            "enum": [
              "hmac-v1",
              "hmac-v2-org-scoped"
            ]
          },
          "link_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "link_exp": {
            "type": [
              "string",
              "null"
            ],
            "description": "The expiry in epoch seconds, as it appears in the link."
          },
          "asymmetric_proof": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "asymmetric_proof_bundle": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "ExecutionTokenRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "execution_token",
          "intent_hash",
          "intent"
        ],
        "properties": {
          "execution_token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "intent_hash": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "intent": {
            "$ref": "#/components/schemas/ExecutionIntentBinding"
          },
          "evidence": {
            "type": "object",
            "additionalProperties": false,
            "description": "Action-bound authority evidence presented again at the claim boundary. Required when the bound policy requires Presence. An attested approval is recorded in the signed binding and is not presented again; the claim re-checks that the attesting key is still registered and active. A signed signal is recorded the same way; the claim re-checks its key and that it has not expired.",
            "properties": {
              "humanApproval": {
                "$ref": "#/components/schemas/HumanApprovalEvidence"
              }
            }
          },
          "consumed_by": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "commit_correlation_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        }
      },
      "ExecutionClaimTokenRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "execution_token",
          "intent_hash",
          "intent"
        ],
        "properties": {
          "execution_token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "intent_hash": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "intent": {
            "$ref": "#/components/schemas/ExecutionIntentBinding"
          },
          "consumed_by": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "commit_correlation_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "claim_lease_seconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 300,
            "default": 30,
            "description": "Pre-commit lease duration. This does not extend the signed execution grant lifetime."
          }
        }
      },
      "ExecutionTokenClaims": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "iss",
          "org_id",
          "dossier_id",
          "decision_id",
          "action",
          "decision",
          "scope",
          "binding",
          "jti",
          "iat",
          "nbf",
          "exp"
        ],
        "properties": {
          "iss": {
            "type": "string"
          },
          "sub": {
            "type": "string"
          },
          "aud": {
            "type": "string"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string"
          },
          "decision_id": {
            "type": "string"
          },
          "chain_id": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "decision": {
            "type": "string",
            "const": "allow"
          },
          "scope": {
            "type": "string",
            "const": "execute"
          },
          "binding": {
            "type": "object",
            "required": [
              "intent_hash"
            ],
            "properties": {
              "intent_hash": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$"
              },
              "execution_binding_digest": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$"
              },
              "execution_payload_digest": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$",
                "description": "Signed digest of the exact downstream request parameters."
              },
              "execution_payload_canonicalization_profile": {
                "type": "string",
                "description": "Canonicalization profile used for execution_payload_digest."
              },
              "execution_nonce": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{43,128}$"
              },
              "execution_correlation_id": {
                "type": "string"
              },
              "expected_effect_digest": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$",
                "description": "Expected downstream effect commitment carried by the grant."
              },
              "expected_state_version": {
                "type": "string",
                "pattern": "^[\\x21-\\x7e]{1,256}$",
                "description": "The target's version the grant was decided against, from the intent's `context.agent_safe.precondition.version`, verbatim."
              },
              "authority_protocol_version": {
                "type": "string",
                "enum": [
                  "1.0",
                  "1.0.0",
                  "1.1"
                ],
                "description": "Protocol semantics governing execution eligibility and effect evidence validation for this grant. Protocol 1.1 grants reject the deprecated legacy effect-evidence shape."
              }
            }
          },
          "jti": {
            "type": "string"
          },
          "iat": {
            "type": "integer"
          },
          "nbf": {
            "type": "integer"
          },
          "exp": {
            "type": "integer"
          }
        }
      },
      "ExecutionTokenResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "valid",
          "reason_codes",
          "claims"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "should_execute": {
            "type": "boolean",
            "description": "Present on pre-commit claim responses. Only true after current-state and Presence revalidation, an atomic nonce claim with durable evidence, and a final database-time claim-lease check."
          },
          "would_block": {
            "type": "boolean",
            "description": "Present on pre-commit claim responses for Shadow diagnostics."
          },
          "verdict": {
            "type": "string",
            "enum": [
              "APPROVE",
              "ESCALATE",
              "REJECT",
              "REVIEW"
            ],
            "description": "Deterministic pre-commit revalidation verdict."
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "claims": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExecutionTokenClaims"
              },
              {
                "type": "null"
              }
            ]
          },
          "claim_token": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Za-z0-9_-]{43,128}$"
          },
          "claim_validated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Database time of the final execution-eligibility confirmation. Qualifying effect observations must not predate this boundary."
          },
          "claim_lease_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "End of the claim's lease. The claim must be finalized before it; after it, the claim is recorded INDETERMINATE and holds its scopes until it is reconciled."
          },
          "claim_attestation": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",
            "description": "Present only on a live claim. A compact EdDSA JWS over `ClaimAttestationClaims`, verifiable against the execution-grant JWKS. Absent or null whenever `should_execute` is not true."
          },
          "evidence": {
            "type": "object",
            "additionalProperties": true
          },
          "evidence_durably_queued": {
            "type": "boolean",
            "description": "True when the canonical revalidation evidence is durably queued in the same transaction as the nonce transition. This does not by itself mean the Protocol Decision Chain append has completed."
          },
          "decision_chain_evidence_recorded": {
            "type": "boolean",
            "description": "True when the queued evidence has already been acknowledged by the Protocol Decision Chain. False evidence remains recoverable when evidence_durably_queued is true."
          }
        }
      },
      "ExecutionClaimTokenResponse": {
        "description": "Successful pre-commit claim response. All three execution-bound fields are required; `valid` alone never authorizes execution.",
        "allOf": [
          {
            "$ref": "#/components/schemas/ExecutionTokenResponse"
          },
          {
            "type": "object",
            "required": [
              "should_execute",
              "claim_token",
              "claim_validated_at",
              "claim_lease_expires_at",
              "claim_attestation"
            ],
            "properties": {
              "should_execute": {
                "type": "boolean",
                "const": true
              },
              "claim_token": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{43,128}$"
              },
              "claim_validated_at": {
                "type": "string",
                "format": "date-time"
              },
              "claim_lease_expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "claim_attestation": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",
                "description": "Compact EdDSA JWS over `ClaimAttestationClaims`."
              }
            }
          }
        ]
      },
      "ExecutionGrantJwks": {
        "type": "object",
        "required": [
          "keys"
        ],
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "kty",
                "crv",
                "x",
                "kid",
                "alg",
                "use"
              ],
              "properties": {
                "kty": {
                  "type": "string",
                  "const": "OKP"
                },
                "crv": {
                  "type": "string",
                  "const": "Ed25519"
                },
                "x": {
                  "type": "string"
                },
                "kid": {
                  "type": "string"
                },
                "alg": {
                  "type": "string",
                  "const": "EdDSA"
                },
                "use": {
                  "type": "string",
                  "const": "sig"
                }
              },
              "additionalProperties": true
            }
          }
        }
      },
      "SignedPolicyBundleResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "signed_bundle",
          "bundle_id",
          "policy_version",
          "kid",
          "issued_at",
          "not_before",
          "expires_at"
        ],
        "properties": {
          "signed_bundle": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",
            "description": "Compact JWS. Protected header `{\"alg\":\"EdDSA\",\"typ\":\"decionis-policy-bundle+jwt\",\"kid\":\"<kid>\"}`; payload `SignedPolicyBundleClaims`."
          },
          "bundle_id": {
            "type": "string"
          },
          "policy_version": {
            "type": "string"
          },
          "kid": {
            "type": "string",
            "maxLength": 128
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "not_before": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SignedPolicyBundleHeader": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "alg",
          "typ",
          "kid"
        ],
        "properties": {
          "alg": {
            "type": "string",
            "const": "EdDSA"
          },
          "typ": {
            "type": "string",
            "const": "decionis-policy-bundle+jwt"
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "SignedPolicyBundleClaims": {
        "type": "object",
        "description": "The payload of a signed policy bundle. `nbf` is the later of `iat` and the bundle's `effective_from`; `exp` the earlier of `iat` + TTL and the bundle's `effective_to`. `bundle_digest` is `sha256:` and the hex SHA-256 of the canonical JSON of `bundle` (keys recursively sorted by UTF-16 code units, JSON.stringify serialization: the intent-hash canonicalization).",
        "additionalProperties": false,
        "required": [
          "iss",
          "aud",
          "iat",
          "nbf",
          "exp",
          "jti",
          "bundle_id",
          "policy_version",
          "bundle_digest",
          "core_abi",
          "vertical_pack",
          "max_mode",
          "max_mode_reason",
          "bundle"
        ],
        "properties": {
          "iss": {
            "type": "string",
            "const": "decionis"
          },
          "aud": {
            "type": "string",
            "format": "uuid",
            "description": "The organization the bundle was issued to."
          },
          "iat": {
            "type": "integer"
          },
          "nbf": {
            "type": "integer"
          },
          "exp": {
            "type": "integer"
          },
          "jti": {
            "type": "string",
            "format": "uuid"
          },
          "bundle_id": {
            "type": "string"
          },
          "policy_version": {
            "type": "string"
          },
          "bundle_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "core_abi": {
            "type": "integer",
            "enum": [
              3,
              7,
              8
            ],
            "description": "The bundle format: 3 carries the organization claims below; 7 is format 3 whose rules compare two facts (`EQ_FACT`, `NEQ_FACT`); 8 is format 7 whose payload declares `allowed_transitions`. An edge module reads formats up to its own ABI and refuses newer ones (`bundle_abi_unsupported`)."
          },
          "vertical_pack": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "description": "The vertical pack hosted evaluation uses for this organization when an intent names none: its configured pack, else the operator's pack override (each only when the registry holds it), else null (the default pack)."
          },
          "max_mode": {
            "type": "string",
            "enum": [
              "ENFORCEMENT",
              "SHADOW"
            ],
            "description": "The most enforcing mode hosted enforce-and-bind allows the organization. SHADOW for an unclaimed provisional workspace or an AWS service workspace."
          },
          "max_mode_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PROVISIONAL_WORKSPACE_SHADOW_ONLY",
              "SERVICE_WORKSPACE_SHADOW_ONLY",
              null
            ],
            "description": "With `max_mode` SHADOW, the code hosted refuses any other mode with (HTTP 403), which the edge answers too; null with ENFORCEMENT."
          },
          "bundle": {
            "$ref": "#/components/schemas/PolicyCoreBundle"
          }
        }
      },
      "PolicyCoreBundle": {
        "type": "object",
        "description": "The bundle exactly as the policy core evaluates it (hosted and edge alike).",
        "additionalProperties": false,
        "required": [
          "bundle_id",
          "version",
          "rules",
          "payload"
        ],
        "properties": {
          "bundle_id": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "rules": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "PolicyBundleNotFound": {
        "type": "object",
        "required": [
          "error",
          "reason"
        ],
        "properties": {
          "error": {
            "type": "string",
            "const": "POLICY_BUNDLE_NOT_FOUND"
          },
          "reason": {
            "type": "string",
            "enum": [
              "missing_org_policy_bundle",
              "no_active_org_policy_bundle",
              "requested_policy_bundle_not_found"
            ],
            "description": "The hosted policy guard's reason. An unapproved bundle (maker-checker) is not active, so it reads `no_active_org_policy_bundle`, or `requested_policy_bundle_not_found` when it was named."
          },
          "message": {
            "type": "string"
          }
        }
      },
      "PolicyBundleIssuance": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jti",
          "bundle_id",
          "policy_version",
          "bundle_digest",
          "kid",
          "decision_domain",
          "issued_at",
          "not_before",
          "expires_at",
          "api_key_id"
        ],
        "properties": {
          "jti": {
            "type": "string",
            "format": "uuid"
          },
          "bundle_id": {
            "type": "string"
          },
          "policy_version": {
            "type": "string"
          },
          "bundle_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "kid": {
            "type": "string"
          },
          "decision_domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "not_before": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "api_key_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The API key that requested it; null once that key is deleted."
          }
        }
      },
      "PolicyBundleIssuanceList": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "issuances"
        ],
        "properties": {
          "issuances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PolicyBundleIssuance"
            }
          }
        }
      },
      "PolicyBundleJwks": {
        "type": "object",
        "required": [
          "keys"
        ],
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "kty",
                "crv",
                "x",
                "kid",
                "alg",
                "use"
              ],
              "properties": {
                "kty": {
                  "type": "string",
                  "const": "OKP"
                },
                "crv": {
                  "type": "string",
                  "const": "Ed25519"
                },
                "x": {
                  "type": "string"
                },
                "kid": {
                  "type": "string"
                },
                "alg": {
                  "type": "string",
                  "const": "EdDSA"
                },
                "use": {
                  "type": "string",
                  "const": "sig"
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      "EdgeEntitlementResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "entitlement",
          "kid",
          "edge",
          "issued_at",
          "expires_at"
        ],
        "properties": {
          "entitlement": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",
            "description": "Compact JWS: protected header `EdgeEntitlementHeader`, payload `EdgeEntitlementClaims`, verified with the policy-bundle JWKS."
          },
          "kid": {
            "type": "string",
            "maxLength": 128
          },
          "edge": {
            "type": "boolean"
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EdgeEntitlementHeader": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "alg",
          "typ",
          "kid"
        ],
        "properties": {
          "alg": {
            "type": "string",
            "const": "EdDSA"
          },
          "typ": {
            "type": "string",
            "const": "decionis-edge-entitlement+jwt"
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "EdgeEntitlementClaims": {
        "type": "object",
        "description": "What the organization is licensed for. An edge installation warns when it is missing or expired, when `edge` is false, when a month's local count exceeds `included_actions_per_month` (or the band), or when a usage report is more than `usage_report_due_days` days past its month's end; it never blocks or degrades a decision on it.",
        "additionalProperties": false,
        "required": [
          "iss",
          "aud",
          "iat",
          "exp",
          "plan",
          "tier",
          "included_actions_per_month",
          "volume_band",
          "edge",
          "usage_report_due_days"
        ],
        "properties": {
          "iss": {
            "type": "string",
            "const": "decionis"
          },
          "aud": {
            "type": "string",
            "format": "uuid",
            "description": "The organization."
          },
          "iat": {
            "type": "integer"
          },
          "exp": {
            "type": "integer",
            "description": "`iat` + 35 days."
          },
          "plan": {
            "type": "string",
            "enum": [
              "exploration",
              "build",
              "starter",
              "defence",
              "premium",
              "scale",
              "enterprise"
            ]
          },
          "tier": {
            "type": "string",
            "enum": [
              "hosted",
              "dedicated",
              "self_managed"
            ]
          },
          "included_actions_per_month": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "The plan's included governed actions per month, when recorded."
          },
          "volume_band": {
            "description": "The contracted volume band; self-managed only, else null. The ceiling is contracted per year; the monthly figure is the yearly one divided by 12, rounded up, for an edge to warn early. Null ceilings mean the contract states none. It never gates anything.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "max_actions_per_year",
                  "max_actions_per_month"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "max_actions_per_year": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1
                  },
                  "max_actions_per_month": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1
                  }
                }
              }
            ]
          },
          "edge": {
            "type": "boolean",
            "description": "Whether the organization is licensed for the edge evaluator (Enterprise, self-managed, Premium with the edge add-on, or an operator pilot)."
          },
          "usage_report_due_days": {
            "type": "integer",
            "const": 35
          }
        }
      },
      "EdgeUsageReportSubmission": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "report"
        ],
        "properties": {
          "report": {
            "type": "string",
            "minLength": 1,
            "maxLength": 524288,
            "description": "The usage report as a compact JWS."
          }
        }
      },
      "EdgeUsageReportHeader": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "alg",
          "typ",
          "kid"
        ],
        "properties": {
          "alg": {
            "type": "string",
            "const": "EdDSA"
          },
          "typ": {
            "type": "string",
            "const": "decionis-edge-usage+jwt"
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The registered `usage_report` key (no surrounding whitespace)."
          }
        }
      },
      "EdgeUsageCounts": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "by_mode",
          "by_verdict",
          "total"
        ],
        "properties": {
          "by_mode": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "ENFORCEMENT",
              "SHADOW"
            ],
            "properties": {
              "ENFORCEMENT": {
                "type": "integer",
                "minimum": 0
              },
              "SHADOW": {
                "type": "integer",
                "minimum": 0
              },
              "PARALLEL": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "by_verdict": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "ALLOW",
              "ESCALATE",
              "BLOCK"
            ],
            "properties": {
              "ALLOW": {
                "type": "integer",
                "minimum": 0
              },
              "ESCALATE": {
                "type": "integer",
                "minimum": 0
              },
              "BLOCK": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "description": "Every edge decision in the month; `by_mode` and `by_verdict` each sum to it."
          }
        }
      },
      "EdgeUsageChain": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "stream",
          "first_seq",
          "last_seq",
          "first_hash",
          "last_hash"
        ],
        "description": "The evidence-chain range the counts were taken from; the four bounds are null exactly when nothing was counted.",
        "properties": {
          "stream": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "first_seq": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "last_seq": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "first_hash": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "last_hash": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      },
      "EdgeUsageReportClaims": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "iss",
          "aud",
          "iat",
          "jti",
          "period",
          "period_start",
          "period_end",
          "counts",
          "delegated",
          "chain",
          "bundles"
        ],
        "properties": {
          "iss": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The installation id; equals the registered key's `issuer`."
          },
          "aud": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The organization."
          },
          "iat": {
            "type": "integer",
            "minimum": 0
          },
          "jti": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "period": {
            "type": "string",
            "pattern": "^2[0-9]{3}-(0[1-9]|1[0-2])$",
            "description": "UTC month."
          },
          "period_start": {
            "type": "string",
            "format": "date-time",
            "description": "The month's first instant."
          },
          "period_end": {
            "type": "string",
            "format": "date-time",
            "description": "The next month's first instant (exclusive)."
          },
          "counts": {
            "$ref": "#/components/schemas/EdgeUsageCounts"
          },
          "delegated": {
            "type": "integer",
            "minimum": 0,
            "description": "The part of `total` handed to hosted Decionis, which meters it itself; not metered again."
          },
          "chain": {
            "$ref": "#/components/schemas/EdgeUsageChain"
          },
          "bundles": {
            "type": "array",
            "maxItems": 10000,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "description": "The signed-bundle `jti`s decided under."
          }
        }
      },
      "EdgeUsageReport": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "installation_id",
          "kid",
          "jti",
          "period",
          "period_start",
          "period_end",
          "issued_at",
          "counts",
          "delegated",
          "billable",
          "chain",
          "bundles",
          "report_digest",
          "supersedes",
          "superseded_by",
          "metered_actions",
          "meter_status",
          "received_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "installation_id": {
            "type": "string"
          },
          "kid": {
            "type": "string"
          },
          "jti": {
            "type": "string"
          },
          "period": {
            "type": "string"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "counts": {
            "$ref": "#/components/schemas/EdgeUsageCounts"
          },
          "delegated": {
            "type": "integer",
            "minimum": 0
          },
          "billable": {
            "type": "integer",
            "minimum": 0,
            "description": "`total - delegated`."
          },
          "chain": {
            "$ref": "#/components/schemas/EdgeUsageChain"
          },
          "bundles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "report_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "supersedes": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "superseded_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "metered_actions": {
            "type": "integer",
            "minimum": 0,
            "description": "What this report added to the meter (beyond earlier reports for its month)."
          },
          "meter_status": {
            "type": "string",
            "enum": [
              "pending",
              "recorded",
              "not_recorded",
              "not_metered"
            ],
            "description": "`not_metered`: the plan is not metered (the hard-capped exploration default); `not_recorded`: the meter did not take it (no billing customer, or the meter was unavailable)."
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EdgeUsageReportAccepted": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "replay",
          "report"
        ],
        "properties": {
          "replay": {
            "type": "boolean"
          },
          "report": {
            "$ref": "#/components/schemas/EdgeUsageReport"
          }
        }
      },
      "EdgeUsageReportList": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reports"
        ],
        "properties": {
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeUsageReport"
            }
          }
        }
      },
      "EdgeUsageReportRefusal": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "USAGE_REPORT_MALFORMED",
              "USAGE_REPORT_KEY_UNKNOWN",
              "USAGE_REPORT_SIGNATURE_INVALID",
              "USAGE_REPORT_ISSUER_MISMATCH",
              "USAGE_REPORT_AUDIENCE_MISMATCH",
              "USAGE_REPORT_ISSUED_IN_FUTURE",
              "USAGE_REPORT_PERIOD_IN_FUTURE",
              "USAGE_REPORT_INCONSISTENT"
            ]
          },
          "message": {
            "type": "string"
          },
          "kid": {
            "type": "string"
          }
        }
      },
      "EdgeUsageReportConflict": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "USAGE_REPORT_DUPLICATE",
              "USAGE_REPORT_JTI_REUSED",
              "USAGE_REPORT_STREAM_CHANGED",
              "USAGE_REPORT_CONCURRENT"
            ]
          },
          "message": {
            "type": "string"
          },
          "current": {
            "$ref": "#/components/schemas/EdgeUsageReport"
          }
        }
      },
      "ClaimAttestationClaims": {
        "type": "object",
        "description": "The payload of `claim_attestation`: proof, signed by the authority with the execution-grant key, that one grant was claimed for one intent and is live until `exp`. A system of record verifies the signature against `/.well-known/decionis-execution-grant-jwks.json`, requires the protected header `typ` to be `decionis-claim-attestation+jwt`, and then checks the request in hand against these claims: `sub` equals the grant id the executor presented, `decision_id` equals the decision id it presented, `binding.intent_hash` equals the intent hash it presented, `binding.execution_payload_digest` equals the digest of the request body under `binding.execution_payload_canonicalization_profile`, and `exp` has not passed. A provider that must refuse a second use keeps `sub` for the length of the lease. When `binding.expected_state_version` is present, the provider then effects only while the target is still at that version. The claim token itself is never carried, only its digest, so a leaked attestation finalizes nothing.",
        "additionalProperties": false,
        "required": [
          "iss",
          "sub",
          "org_id",
          "dossier_id",
          "decision_id",
          "binding",
          "claim_token_digest",
          "claim_validated_at",
          "jti",
          "iat",
          "nbf",
          "exp"
        ],
        "properties": {
          "iss": {
            "type": "string",
            "const": "https://decionis.com"
          },
          "sub": {
            "type": "string",
            "description": "The `jti` of the grant this claim was made against."
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string"
          },
          "decision_id": {
            "type": "string"
          },
          "binding": {
            "type": "object",
            "additionalProperties": false,
            "description": "The binding the grant carried, copied field for field. Empty for a grant that bound nothing; never invented.",
            "properties": {
              "intent_hash": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$"
              },
              "execution_payload_digest": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$",
                "description": "Digest of the exact downstream request parameters."
              },
              "execution_payload_canonicalization_profile": {
                "type": "string",
                "description": "How to canonicalize the request body before digesting it, for example `RFC8785/JCS`."
              },
              "expected_effect_digest": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$"
              },
              "expected_state_version": {
                "type": "string",
                "pattern": "^[\\x21-\\x7e]{1,256}$",
                "description": "The target's version the grant was decided against. A verifying provider effects only while the target is at exactly this version, compared byte for byte and atomically with the effect, as a conditional write (`If-Match`) is, and refuses `TARGET_STATE_CHANGED` otherwise. Absent when the intent stated no precondition."
              },
              "execution_nonce": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{43,128}$"
              },
              "execution_correlation_id": {
                "type": "string"
              }
            }
          },
          "claim_token_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "SHA-256 of the claim token, never the token."
          },
          "claim_validated_at": {
            "type": "string",
            "format": "date-time"
          },
          "jti": {
            "type": "string",
            "format": "uuid",
            "description": "The attestation's own identity, distinct from the grant's."
          },
          "iat": {
            "type": "integer"
          },
          "nbf": {
            "type": "integer"
          },
          "exp": {
            "type": "integer",
            "description": "The claim lease, as an epoch second. Nothing is attested past it."
          }
        }
      },
      "EffectReceiptClaims": {
        "type": "object",
        "description": "The payload of an effect receipt (Verifying Provider Profile, VP-3): a system of record's own signed statement of what it effected under one grant, in answer to one claim. The provider signs it with a key the organisation registered at `/v1/execution/provider-keys`, with protected header `alg` EdDSA, `typ` `decionis-effect-receipt+jwt` and `kid`, and returns it to the executor, which forwards it at finalization. Decionis verifies the signature under the registered key, requires `iss` to be the issuer registered with that key and `aud` to be this authority, then checks that the receipt describes the finalization in hand: `sub` equals the grant's `jti`, `decision_id` and `dossier_id` equal the grant's, and `claim_token_digest` equals the digest of the claim token being finalized, which the provider can only have copied from the attestation of this very claim. A receipt that fails any check is recorded as presented and confirms nothing.",
        "additionalProperties": true,
        "required": [
          "iss",
          "aud",
          "sub",
          "decision_id",
          "dossier_id",
          "claim_token_digest",
          "effect",
          "iat",
          "jti"
        ],
        "properties": {
          "iss": {
            "type": "string",
            "description": "The issuer registered with the signing key."
          },
          "aud": {
            "type": "string",
            "const": "https://decionis.com"
          },
          "sub": {
            "type": "string",
            "description": "The `jti` of the grant the effect was made under."
          },
          "decision_id": {
            "type": "string"
          },
          "dossier_id": {
            "type": "string"
          },
          "claim_token_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "Copied from the claim attestation the provider verified before effecting."
          },
          "attestation_jti": {
            "type": "string",
            "description": "The `jti` of that attestation, when the provider records it."
          },
          "intent_hash": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "When present, must equal the intent hash the grant bound."
          },
          "idempotency_key": {
            "type": "string",
            "description": "The idempotency key of the request the provider effected."
          },
          "effect": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "status",
              "effected_at"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "EFFECTED",
                  "REFUSED",
                  "INDETERMINATE"
                ],
                "description": "What the provider did with the claimed request. REFUSED and INDETERMINATE are receipts too: a provider's signed refusal is evidence in a dossier."
              },
              "reference": {
                "type": "string",
                "maxLength": 2000,
                "description": "The provider's own reference for the effect, for example a ledger entry id."
              },
              "digest": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$",
                "description": "The digest of the effect as the provider observed it, in the grant's effect commitment terms. When the grant carries `expected_effect_digest`, equality is what confirms the effect."
              },
              "effected_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "iat": {
            "type": "integer"
          },
          "jti": {
            "type": "string",
            "description": "Unique per receipt."
          }
        }
      },
      "ExecutionEffectEvidence": {
        "type": "object",
        "additionalProperties": false,
        "deprecated": true,
        "description": "Deployed pre-Protocol-1.1 effect record. It remains accepted and verifiable for grants issued under its original request/outcome-binding rules. Protocol 1.1 grants reject this shape to prevent an evidence semantics downgrade. New integrations should emit EffectEvidence.",
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "const": "CONFIRMED"
                }
              },
              "required": [
                "status"
              ]
            },
            "then": {
              "properties": {
                "response_digest": {
                  "type": "string",
                  "pattern": "^sha256:[0-9a-f]{64}$"
                }
              }
            }
          }
        ],
        "required": [
          "effect_schema_version",
          "status",
          "request_digest",
          "response_digest",
          "digest_algorithm",
          "canonicalization_profile",
          "external_reference",
          "observation_mode",
          "observer",
          "observed_at",
          "metadata_digest"
        ],
        "properties": {
          "effect_schema_version": {
            "type": "string",
            "const": "1.0"
          },
          "status": {
            "type": "string",
            "enum": [
              "CONFIRMED",
              "FAILED",
              "INDETERMINATE"
            ],
            "description": "CONFIRMED means the execution gate directly observed a digestible response."
          },
          "request_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "Must equal the execution payload digest signed into the grant."
          },
          "response_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "Required when status is CONFIRMED; null otherwise."
          },
          "digest_algorithm": {
            "type": "string",
            "const": "SHA-256"
          },
          "canonicalization_profile": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Canonicalization profile for the response digest when present; otherwise the request digest profile."
          },
          "external_reference": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 2000
          },
          "observation_mode": {
            "type": "string",
            "enum": [
              "GATE_OBSERVED",
              "RUNTIME_REPORTED"
            ]
          },
          "observer": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            }
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "metadata_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      },
      "EffectObservationMethod": {
        "type": "string",
        "enum": [
          "DOWNSTREAM_ACK",
          "READ_AFTER_WRITE",
          "EVENT_CONFIRMATION",
          "STATE_RECONCILIATION",
          "SIGNED_RECEIPT",
          "EXTERNAL_ATTESTATION",
          "HUMAN_VALIDATION"
        ],
        "description": "Versioned identifier for how the downstream effect was observed. DOWNSTREAM_ACK is weak evidence and cannot independently confirm an effect."
      },
      "EffectEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "Optional Protocol 1.1 observation evidence. COMMITTED remains an executor-reported finalization state and is not CONFIRMED without a qualifying record. Raw provider responses should remain outside the evidence artifact; use commitments and immutable references.",
        "required": [
          "version",
          "status",
          "observation_method",
          "observer",
          "expected_effect_digest",
          "observed_effect_digest",
          "observed_at",
          "evidence_digest",
          "evidence_reference",
          "execution_correlation_id"
        ],
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "const": "CONFIRMED"
                }
              },
              "required": [
                "status"
              ]
            },
            "then": {
              "required": [
                "observer",
                "observed_effect_digest",
                "observed_at"
              ],
              "allOf": [
                {
                  "not": {
                    "properties": {
                      "observation_method": {
                        "const": "DOWNSTREAM_ACK"
                      }
                    },
                    "required": [
                      "observation_method"
                    ]
                  }
                },
                {
                  "properties": {
                    "observer": {
                      "type": "object",
                      "required": [
                        "id",
                        "version"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500,
                          "pattern": ".*\\S.*"
                        },
                        "version": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500,
                          "pattern": ".*\\S.*"
                        }
                      }
                    },
                    "observed_effect_digest": {
                      "type": "string",
                      "pattern": "^sha256:[0-9a-f]{64}$"
                    },
                    "observed_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                {
                  "anyOf": [
                    {
                      "properties": {
                        "evidence_digest": {
                          "type": "string",
                          "pattern": "^sha256:[0-9a-f]{64}$"
                        }
                      },
                      "required": [
                        "evidence_digest"
                      ]
                    },
                    {
                      "properties": {
                        "evidence_reference": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        }
                      },
                      "required": [
                        "evidence_reference"
                      ]
                    }
                  ]
                }
              ]
            }
          }
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "1.0"
          },
          "status": {
            "type": "string",
            "enum": [
              "CONFIRMED",
              "UNCONFIRMED"
            ]
          },
          "observation_method": {
            "$ref": "#/components/schemas/EffectObservationMethod"
          },
          "observer": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "id",
                  "version"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "pattern": ".*\\S.*"
                  },
                  "version": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 500,
                    "pattern": ".*\\S.*"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_effect_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "observed_effect_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "For CONFIRMED evidence, must equal expected_effect_digest."
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "evidence_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "evidence_reference": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 500
          },
          "execution_correlation_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Must exactly equal the bound commit correlation identifier."
          }
        }
      },
      "ExecutionFinalizeRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "execution_token",
          "claim_token",
          "outcome",
          "commit_correlation_id"
        ],
        "properties": {
          "execution_token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "claim_token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43,128}$"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "COMMITTED",
              "FAILED",
              "INDETERMINATE"
            ]
          },
          "commit_correlation_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "downstream_evidence": {
            "type": "object",
            "additionalProperties": true,
            "description": "Free-form legacy evidence; never interpreted as effect confirmation."
          },
          "native_receipt": {
            "$ref": "#/components/schemas/NativeReceipt"
          },
          "effect_evidence": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EffectEvidence"
              },
              {
                "$ref": "#/components/schemas/ExecutionEffectEvidence"
              }
            ],
            "description": "When effect evidence is present for a Protocol 1.1 grant it must use the Protocol 1.1 shape. Effect confirmation remains optional. The legacy shape remains accepted only for historical grants and keeps its original verification semantics."
          },
          "effect_receipt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000,
            "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",
            "description": "A verifying provider's effect receipt, forwarded by the executor exactly as the provider returned it: a compact EdDSA JWS whose protected header `typ` is `decionis-effect-receipt+jwt` and whose payload is `EffectReceiptClaims`. Verified against the organisation's registered provider keys and recorded whatever the verdict; never a reason to refuse the finalization."
          }
        }
      },
      "NativeReceipt": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "platform",
          "kind",
          "reference",
          "status",
          "observed_at"
        ],
        "description": "What a permit-style platform recorded when it carried the action out (a posted journal, an acknowledged order). Recorded as `downstream_evidence.native_receipt`, replacing any value the executor put there; the executor's report of the attempt, never effect confirmation by itself.",
        "properties": {
          "platform": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z0-9][a-z0-9._-]*$"
          },
          "kind": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9._-]*$"
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "status": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z][A-Za-z0-9._-]*$"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      },
      "ExecutionGrantReconciliationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "execution_token",
          "claim_token",
          "commit_correlation_id",
          "outcome",
          "effect_evidence"
        ],
        "properties": {
          "execution_token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "claim_token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43,128}$",
            "description": "The claim token the grant's claim returned."
          },
          "commit_correlation_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "outcome": {
            "type": "string",
            "enum": [
              "COMMITTED",
              "FAILED"
            ]
          },
          "reconciliation_note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "Free-form context; never identity. A fixed note naming the grant is recorded when absent."
          },
          "downstream_evidence": {
            "type": "object",
            "additionalProperties": true
          },
          "effect_evidence": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EffectEvidence"
              },
              {
                "$ref": "#/components/schemas/ExecutionEffectEvidence"
              }
            ],
            "description": "Protocol 1.1 evidence must be CONFIRMED to resolve COMMITTED, and cannot resolve FAILED; legacy evidence must name the reconciling principal as its observer."
          }
        }
      },
      "ExecutionGrantReconciliationResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reconciled",
          "reason_codes"
        ],
        "properties": {
          "reconciled": {
            "type": "boolean"
          },
          "resolution": {
            "type": "string",
            "enum": [
              "FINALIZED",
              "FAILED"
            ]
          },
          "reconciliation_id": {
            "type": "string",
            "format": "uuid"
          },
          "evidence_hash": {
            "type": "string"
          },
          "decision_chain_evidence_recorded": {
            "type": "boolean"
          },
          "assumption_breach": {
            "$ref": "#/components/schemas/AssumptionBreachOpened"
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AssumptionBreachOpened": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "breach_id",
          "trigger",
          "created"
        ],
        "description": "The assumption breach this report opened, or had already opened: an observed outcome that contradicts what the grant was bound to. While it is open the authority supplies it to policy, at enforce-and-bind and at every claim in the same action and target, as the fact `history.assumption_breach`; it is not a material signal and adds no claim concurrency scope. It clears only through a governed policy release or an independent recovery review that cites it and every piece of its evidence. Present only when a breach was opened; the report's own answer is unchanged by it.",
        "properties": {
          "breach_id": {
            "type": "string",
            "format": "uuid"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "EFFECT_MISMATCH",
              "EFFECT_RECEIPT_CONTRADICTION",
              "RECONCILIATION_CONTRADICTION"
            ]
          },
          "created": {
            "type": "boolean",
            "description": "False when an earlier report of the same evidence already opened it."
          }
        }
      },
      "ExecutionFinalizeResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "finalized",
          "reason_codes"
        ],
        "properties": {
          "finalized": {
            "type": "boolean"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "COMMITTED",
              "FAILED",
              "INDETERMINATE"
            ]
          },
          "evidence_recorded": {
            "type": "boolean",
            "description": "Compatibility field reporting immediate Decision Chain acknowledgement."
          },
          "evidence_durably_queued": {
            "type": "boolean",
            "description": "True when commit evidence was persisted transactionally with the terminal claim state, including lease-expiry INDETERMINATE."
          },
          "decision_chain_evidence_recorded": {
            "type": "boolean",
            "description": "True when the Protocol Decision Chain had already acknowledged the commit evidence when this response was formed; false is delivered asynchronously from the durable outbox."
          },
          "effect_evidence_recorded": {
            "type": "boolean"
          },
          "effect_confirmation": {
            "type": "string",
            "enum": [
              "CONFIRMED",
              "UNCONFIRMED"
            ]
          },
          "effect_receipt": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "verified",
              "verification_code",
              "provider_key_id",
              "recorded"
            ],
            "description": "Present when the request carried an `effect_receipt`.",
            "properties": {
              "verified": {
                "type": "boolean",
                "description": "True when the receipt's signature verified under a registered provider key and its claims describe this grant and this claim."
              },
              "verification_code": {
                "type": "string",
                "enum": [
                  "EFFECT_RECEIPT_VERIFIED",
                  "EFFECT_RECEIPT_MALFORMED",
                  "EFFECT_RECEIPT_KEY_UNKNOWN",
                  "EFFECT_RECEIPT_SIGNATURE_INVALID",
                  "EFFECT_RECEIPT_BINDING_MISMATCH",
                  "EFFECT_RECEIPT_KEYS_UNAVAILABLE"
                ]
              },
              "provider_key_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The `kid` the receipt named, when it named one."
              },
              "recorded": {
                "type": "boolean",
                "description": "True when the receipt was persisted in the commit evidence, which is whenever the claim finalized."
              }
            }
          },
          "assumption_breach": {
            "$ref": "#/components/schemas/AssumptionBreachOpened"
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProtocolEvaluateDecisionRequest": {
        "type": "object",
        "required": [
          "decision_type"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional when authenticated with an organization API key."
          },
          "decision_type": {
            "type": "string"
          },
          "amount": {
            "type": "number"
          },
          "risk_score": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "channel": {
            "type": "string"
          },
          "policy_version": {
            "type": "string",
            "description": "The exact active policy bundle version to decide under. A named version the organization does not hold fails closed (policy_guard.reason requested_policy_bundle_not_found, outcome ESCALATE); it is never silently substituted. Omit it to decide under the newest active bundle — the response's policy_bundle_resolution says which happened."
          },
          "require_exact_policy_version": {
            "type": "boolean",
            "description": "Accepted for compatibility. Exact matching is now the default whenever policy_version is named."
          },
          "objective_profile": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ],
            "description": "Absent means SHADOW. The spellings enforce and enforced are accepted as ENFORCEMENT; any other value is a 400, never a silent SHADOW."
          },
          "decision_band": {
            "type": "string"
          },
          "transaction_type": {
            "type": "string"
          },
          "workflow_key": {
            "type": "string"
          },
          "vertical_pack": {
            "type": "string"
          },
          "agent_attribution": {
            "type": "object",
            "additionalProperties": false,
            "minProperties": 1,
            "description": "What the calling agent reported about producing the action: agent, model, provider, tokens and cost. Recorded on the Decision Dossier's inputs snapshot as client-reported (reported_by client, platform_verified false); never verified, never a policy fact. Absent is fine; present but malformed is a 400.",
            "properties": {
              "agent_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]*$"
              },
              "provider": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "model": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "pattern": "^[\\w.:/@-]+$"
              },
              "input_tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "output_tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "reported_cost": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "amount",
                  "currency"
                ],
                "properties": {
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  }
                }
              }
            }
          },
          "context": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arbitrary evaluated facts. A matched ESCALATE rule can issue a\nPresence Authority Requirement only when `action_context` conforms\nto `PresenceActionContext`; the digest binds that complete canonical\nobject and unknown action fields are excluded from the binding.\n`context.authority_requirement` is reserved and rejected; callers\ncannot promote their own JSON into trusted authority policy.\n`context.decionis_policy` describes the repository's policy file\n(the workflow gate's `DECIONIS_POLICY.md`) and is recorded with the\ndecision. Its `sha256` must be the SHA-256 of its UTF-8 `content`:\nDecionis hashes the content itself, and from a descriptor claiming\nanother hash it neither versions nor publishes anything (the event\n`policy.file.encode_rejected` records it). With `enforce: true`,\nits `decionis` rules block is published as the workspace's ACTIVE\nenforced bundle only when the key holds `policy:write`, `policy:*`\nor `org:*`; for any other key the decision is unaffected, nothing\nis published, and the response carries\n`x-decionis-warning: POLICY_ENFORCE_SCOPE_MISSING`.\n"
          },
          "idempotency_key": {
            "type": "string"
          },
          "decision_chain": {
            "$ref": "#/components/schemas/DecisionChainRequest"
          }
        },
        "additionalProperties": true
      },
      "ProtocolEvaluationReceipt": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "status",
              "evaluation_id",
              "mode"
            ],
            "properties": {
              "status": {
                "type": "string",
                "const": "recorded"
              },
              "evaluation_id": {
                "type": "string",
                "format": "uuid"
              },
              "mode": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "SHADOW",
                  "PARALLEL",
                  "ENFORCEMENT",
                  null
                ],
                "description": "Persisted effective mode, or null when historical evidence is absent or inconsistent."
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "status",
              "evaluation_id",
              "mode"
            ],
            "properties": {
              "status": {
                "type": "string",
                "const": "not_found"
              },
              "evaluation_id": {
                "type": "null"
              },
              "mode": {
                "type": "null"
              }
            }
          }
        ]
      },
      "ProtocolEvaluateDecisionResponse": {
        "type": "object",
        "allOf": [
          {
            "if": {
              "properties": {
                "protocol_version": {
                  "const": "1.1"
                }
              },
              "required": [
                "protocol_version"
              ]
            },
            "then": {
              "required": [
                "verdict",
                "authority_classification",
                "execution_eligible",
                "policy_reference",
                "evaluation_semantics",
                "input_snapshot_digest",
                "execution_binding_digest"
              ]
            }
          }
        ],
        "required": [
          "outcome",
          "confidence",
          "policy_version",
          "objective_profile",
          "dossier_id",
          "evaluation_id",
          "mode",
          "fallback_to_legacy",
          "governance_metrics",
          "idempotent_replay"
        ],
        "properties": {
          "protocol_version": {
            "type": "string",
            "const": "1.1"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "APPROVE",
              "ESCALATE",
              "REJECT",
              "REVIEW"
            ]
          },
          "verdict": {
            "type": "string",
            "enum": [
              "ALLOW",
              "ESCALATE",
              "BLOCK"
            ]
          },
          "authority_classification": {
            "$ref": "#/components/schemas/AuthorityClassification"
          },
          "execution_eligible": {
            "type": "boolean"
          },
          "policy_reference": {
            "$ref": "#/components/schemas/PolicyReference"
          },
          "evaluation_semantics": {
            "$ref": "#/components/schemas/EvaluationSemantics"
          },
          "input_snapshot_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "execution_binding_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "Commitment to the exact-action ExecutionBinding when one is present. Null on observational or otherwise non-execution-eligible Protocol 1.1 evaluations."
          },
          "confidence": {
            "type": "number"
          },
          "policy_version": {
            "type": "string"
          },
          "objective_profile": {
            "type": "string"
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_sha256": {
            "type": "string",
            "nullable": true
          },
          "evaluation_id": {
            "type": "string",
            "format": "uuid"
          },
          "decision_resolution_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "ledger_entry_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "ledger_entry_hash": {
            "type": "string",
            "nullable": true
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ]
          },
          "fallback_to_legacy": {
            "type": "boolean"
          },
          "fallback_reason": {
            "type": "string",
            "nullable": true,
            "description": "The rollout's reason for a legacy fallback, or the policy guard's reason when the guard blocked. In SHADOW this reads mode_not_enforcement by design; enforcement_effect states the mode's effect on its own."
          },
          "enforcement_effect": {
            "type": "object",
            "description": "What this mode does with the verdict. The outcome is the same function of policy and request in every mode; ENFORCEMENT binds it (BINDING), SHADOW and PARALLEL observe it (OBSERVED).",
            "properties": {
              "effective_mode": {
                "type": "string",
                "enum": [
                  "SHADOW",
                  "PARALLEL",
                  "ENFORCEMENT"
                ]
              },
              "verdict_effect": {
                "type": "string",
                "enum": [
                  "BINDING",
                  "OBSERVED"
                ]
              },
              "reason": {
                "type": "string",
                "enum": [
                  "enforcement_mode",
                  "shadow_mode_observes_only",
                  "parallel_mode_observes_only",
                  "policy_guard_blocked"
                ]
              }
            }
          },
          "policy_bundle_resolution": {
            "type": "object",
            "description": "How the deciding bundle was chosen, on every response, so a default is never mistaken for the version the caller named.",
            "properties": {
              "requested_policy_version": {
                "type": "string",
                "nullable": true
              },
              "resolved_policy_version": {
                "type": "string",
                "nullable": true
              },
              "status": {
                "type": "string",
                "enum": [
                  "exact_match",
                  "newest_active",
                  "requested_not_found",
                  "policy_guard"
                ]
              }
            }
          },
          "governance_metrics": {
            "type": "object",
            "additionalProperties": true
          },
          "policy_guard": {
            "type": "object",
            "additionalProperties": true
          },
          "policy_evaluation": {
            "type": "object",
            "additionalProperties": true
          },
          "decision_chain": {
            "$ref": "#/components/schemas/DecisionChainSummary"
          },
          "policy_snapshot": {
            "type": "object",
            "additionalProperties": true,
            "description": "Hash-backed reference to the encoded policy bundle evaluated by the protocol."
          },
          "execution_binding": {
            "type": "object",
            "additionalProperties": true,
            "description": "Exact-action ExecutionBinding v1.0. Absent on observational or otherwise non-execution-eligible evaluations."
          },
          "authority_requirement": {
            "$ref": "#/components/schemas/AuthorityRequirement",
            "description": "Present only for an ENFORCEMENT-mode matched ESCALATE rule with\nexplicit policy-owned authority settings and a valid canonical action_context. Human\napproval is evidence; callers must keep execution held until a later\nDecionis re-evaluation authorizes release.\n"
          },
          "idempotent_replay": {
            "type": "boolean"
          },
          "verification": {
            "$ref": "#/components/schemas/DecisionDossierVerificationEnvelope",
            "description": "Attached when the evaluation left a dossier and the envelope could be built; a failure to build it is logged and omitted, never a failed decision."
          }
        },
        "additionalProperties": true
      },
      "PresenceActorContext": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "claimed_location": {
            "type": "string",
            "minLength": 1
          },
          "ip_geo": {
            "type": "string",
            "minLength": 1
          },
          "ip_asn": {
            "type": "string",
            "minLength": 1
          },
          "is_vpn": {
            "type": "boolean"
          },
          "device_posture": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "PresenceActionContext": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "intent",
          "surface",
          "actor_id",
          "target_resource_id"
        ],
        "properties": {
          "intent": {
            "type": "string",
            "minLength": 1
          },
          "surface": {
            "type": "string",
            "minLength": 1
          },
          "actor_id": {
            "type": "string",
            "minLength": 1
          },
          "target_resource_id": {
            "type": "string",
            "minLength": 1
          },
          "provider_event_id": {
            "type": "string",
            "minLength": 1
          },
          "amount": {
            "type": "number",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          },
          "recipient_iban": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "account": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "account_no": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "actor_context": {
            "$ref": "#/components/schemas/PresenceActorContext"
          }
        }
      },
      "AuthoritySelector": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "role_id"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "const": "ROLE"
              },
              "role_id": {
                "type": "string",
                "pattern": "^[A-Z][A-Z0-9_]{1,63}$"
              },
              "principal_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "Optional exact-human narrowing for managed role selection. The selected principal must still hold the trusted human role."
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "principal_id"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "const": "PRINCIPAL"
              },
              "principal_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "role_id": {
                "type": "string",
                "pattern": "^[A-Z][A-Z0-9_]{1,63}$",
                "description": "Trusted effective human approval role. Optional for DIRECT requirements and required when orchestration.mode is MANAGED."
              }
            }
          }
        ]
      },
      "AuthorityVerificationRequirements": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "level",
          "methods",
          "hardware_pki_required",
          "disallow_virtual_cameras"
        ],
        "properties": {
          "level": {
            "type": "string",
            "enum": [
              "STANDARD",
              "HIGH_CONFIDENCE"
            ]
          },
          "methods": {
            "type": "array",
            "minItems": 1,
            "maxItems": 3,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "WEBAUTHN",
                "MOBILE_DEVICE",
                "ACTIVE_LIVENESS",
                "CARD_TAP"
              ]
            },
            "description": "WEBAUTHN, MOBILE_DEVICE and ACTIVE_LIVENESS are ceremonies Decionis Presence runs. CARD_TAP is the cardholder tapping the physical card on their own phone inside the issuer's app, proved by a third-party presence provider named in `provider`; a requirement never mixes the two kinds."
          },
          "hardware_pki_required": {
            "type": "boolean"
          },
          "disallow_virtual_cameras": {
            "type": "boolean"
          },
          "mobile_device_policy": {
            "type": "string",
            "enum": [
              "WEB_OR_JIT_DEVICE",
              "MANAGED_DEVICE_REQUIRED"
            ]
          },
          "trusted_ip_regions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "provider": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_.:-]{0,63}$",
            "description": "Who proves the person. Absent, or `decionis`, Decionis Presence runs the ceremony. Any other id names a presence provider from the directory (GET /v1/presence-providers) that the organisation admitted; its signed presence attestation (`evidence.humanApproval` of provider `attestation`, `presence.method` `card_tap`) is the proof. `presence` is reserved and refused."
          }
        }
      },
      "AuthorityResolutionPolicy": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "quorum",
          "delegation",
          "fallback_role_ids"
        ],
        "properties": {
          "quorum": {
            "type": "integer",
            "const": 1
          },
          "delegation": {
            "type": "string",
            "enum": [
              "DISALLOWED",
              "REQUIREMENT_REFRESH"
            ]
          },
          "fallback_role_ids": {
            "type": "array",
            "maxItems": 10,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[A-Z][A-Z0-9_]{1,63}$"
            }
          }
        }
      },
      "AuthorityOriginator": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "organization_id",
          "organization_name",
          "provenance"
        ],
        "properties": {
          "organization_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "organization_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "actor_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "display_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "role": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "provenance": {
            "type": "string",
            "enum": [
              "AUTHENTICATED_TENANT",
              "VERIFIED_CONNECTOR",
              "CALLER_DECLARED"
            ]
          }
        }
      },
      "AuthorityPresentation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "locale",
          "title",
          "description",
          "display_fields"
        ],
        "properties": {
          "locale": {
            "type": "string",
            "minLength": 2,
            "maxLength": 35,
            "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "display_fields": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "key",
                "label",
                "value"
              ],
              "properties": {
                "key": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "value": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500
                }
              }
            }
          }
        }
      },
      "ManagedAuthorityOrchestration": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode",
          "escalation_id"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "const": "MANAGED"
          },
          "escalation_id": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          }
        },
        "description": "Server-issued routing metadata. It identifies managed orchestration but is not execution authority and does not create an ExecutionBinding."
      },
      "AuthorityRequirement": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requirement_version",
          "requirement_id",
          "source_decision_id",
          "source_dossier_id",
          "policy_version",
          "policy_reason_codes",
          "action_digest",
          "selector",
          "verification_requirements",
          "resolution",
          "originator",
          "presentation",
          "nonce",
          "issued_at",
          "expires_at"
        ],
        "properties": {
          "requirement_version": {
            "type": "string",
            "const": "decionis.authority_requirement/1"
          },
          "requirement_id": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "source_decision_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "source_dossier_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "policy_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "policy_reason_codes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "pattern": "^[A-Z][A-Z0-9_]{1,119}$"
            }
          },
          "action_digest": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "selector": {
            "$ref": "#/components/schemas/AuthoritySelector"
          },
          "verification_requirements": {
            "$ref": "#/components/schemas/AuthorityVerificationRequirements"
          },
          "resolution": {
            "$ref": "#/components/schemas/AuthorityResolutionPolicy"
          },
          "originator": {
            "$ref": "#/components/schemas/AuthorityOriginator"
          },
          "presentation": {
            "$ref": "#/components/schemas/AuthorityPresentation"
          },
          "nonce": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43,128}$"
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Must be later than issued_at."
          },
          "orchestration": {
            "$ref": "#/components/schemas/ManagedAuthorityOrchestration"
          }
        }
      },
      "ProtocolDecisionDossierResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "service",
          "protocol_version",
          "dossier"
        ],
        "properties": {
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "dossier": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "dossier_id",
              "org_id",
              "decision_evaluation_id",
              "dossier_payload",
              "evidence_hashes",
              "created_at",
              "updated_at"
            ],
            "properties": {
              "dossier_id": {
                "type": "string",
                "format": "uuid"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "decision_evaluation_id": {
                "type": "string",
                "format": "uuid"
              },
              "dossier_payload": {
                "type": "object",
                "additionalProperties": true
              },
              "evidence_hashes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "AgentActionCapsuleV04": {
        "type": "object",
        "description": "Agent Action Capsule compatibility profile pinned to draft-mih-scitt-agent-action-capsule-04, format 4, using plain RFC 8785/JCS.",
        "required": [
          "spec_version",
          "format_version",
          "canonicalization_id",
          "capsule_id",
          "action_id",
          "action_type",
          "operator",
          "developer",
          "timestamp",
          "disposition",
          "assurance"
        ],
        "properties": {
          "spec_version": {
            "type": "string",
            "const": "draft-mih-scitt-agent-action-capsule-04"
          },
          "format_version": {
            "type": "string",
            "const": "4"
          },
          "canonicalization_id": {
            "type": "string",
            "const": "jcs"
          },
          "capsule_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "action_id": {
            "type": "string",
            "minLength": 1
          },
          "decision_id": {
            "type": "string",
            "minLength": 1
          },
          "action_type": {
            "type": "string",
            "enum": [
              "fyi",
              "decide"
            ]
          },
          "operator": {
            "type": "string",
            "minLength": 1
          },
          "developer": {
            "type": "string",
            "minLength": 1
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "epoch_id": {
            "type": "string",
            "minLength": 1
          },
          "disposition": {
            "type": "object",
            "required": [
              "decision",
              "approver",
              "human_disposed"
            ],
            "properties": {
              "decision": {
                "type": "string"
              },
              "approver": {
                "type": "string",
                "enum": [
                  "human",
                  "policy",
                  "counterparty"
                ]
              },
              "human_disposed": {
                "type": "boolean"
              },
              "authority": {
                "type": "string"
              },
              "verdict_class": {
                "type": "string"
              },
              "reason_digest": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            },
            "additionalProperties": true
          },
          "effect": {
            "type": "object",
            "required": [
              "type",
              "status",
              "irreversibility_class"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "planned",
                  "dispatched",
                  "confirmed",
                  "failed",
                  "reverted"
                ]
              },
              "request_digest": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "response_digest": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "external_ref": {
                "type": "string"
              },
              "irreversibility_class": {
                "type": "string"
              },
              "effect_attestation": {
                "type": "string"
              }
            },
            "additionalProperties": true
          },
          "assurance": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "attestation_mode",
              "effect_mode",
              "ledger_mode"
            ],
            "properties": {
              "attestation_mode": {
                "type": "string",
                "enum": [
                  "self_attested",
                  "anchored"
                ]
              },
              "effect_mode": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "dispatched_unconfirmed",
                  "confirmed"
                ]
              },
              "ledger_mode": {
                "type": "string",
                "enum": [
                  "standalone",
                  "chained",
                  "anchored"
                ]
              }
            }
          },
          "constraints": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "result",
                "severity",
                "blocking"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "check_type": {
                  "type": "string"
                },
                "method": {
                  "type": "string"
                },
                "result": {
                  "type": "string",
                  "enum": [
                    "pass",
                    "fail",
                    "n/a"
                  ]
                },
                "severity": {
                  "type": "string"
                },
                "blocking": {
                  "type": "boolean"
                },
                "evidence_digest": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              },
              "additionalProperties": false
            }
          },
          "chain": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "parent_capsule_id",
              "relation"
            ],
            "properties": {
              "parent_capsule_id": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "relation": {
                "type": "string"
              }
            }
          },
          "references": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "type",
                "digest_alg",
                "digest"
              ],
              "properties": {
                "type": {
                  "type": "string"
                },
                "digest_alg": {
                  "type": "string"
                },
                "digest": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "citation_purpose": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true
      },
      "AgentActionCapsuleProducerEnvelopeResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "service",
          "protocol_version",
          "capsule_id",
          "payload_encoding",
          "signing_available",
          "envelopes"
        ],
        "properties": {
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "capsule_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "payload_encoding": {
            "type": "string",
            "const": "raw-32-byte-capsule-id"
          },
          "signing_available": {
            "type": "boolean"
          },
          "envelopes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "media_type",
                "profile",
                "content_type",
                "key_id",
                "cose_sign1_base64url",
                "verification"
              ],
              "properties": {
                "media_type": {
                  "type": "string",
                  "const": "application/cose"
                },
                "profile": {
                  "type": "string",
                  "const": "draft-mih-scitt-agent-action-capsule-04"
                },
                "content_type": {
                  "type": "string",
                  "const": "application/agent-action-capsule-id"
                },
                "key_id": {
                  "type": "string"
                },
                "cose_sign1_base64url": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]+$"
                },
                "verification": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "ScittCapsuleRegistrationResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "capsule_id",
          "anchored",
          "registration"
        ],
        "properties": {
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "capsule_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "idempotent": {
            "type": "boolean"
          },
          "anchored": {
            "type": "boolean",
            "description": "True only when both the Signed Statement and receipt profile verify."
          },
          "status_path": {
            "type": "string"
          },
          "registration": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "org_id",
              "dossier_id",
              "capsule_id",
              "transparency_service",
              "status",
              "registration_statement_base64url",
              "statement_verified",
              "receipt_verified",
              "attempt_count",
              "created_at",
              "updated_at"
            ],
            "properties": {
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "dossier_id": {
                "type": "string",
                "format": "uuid"
              },
              "capsule_id": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "transparency_service": {
                "type": "string",
                "format": "uri"
              },
              "status": {
                "type": "string",
                "enum": [
                  "PENDING",
                  "REGISTERING",
                  "RECEIPT_UNVERIFIED",
                  "ANCHORED",
                  "FAILED"
                ]
              },
              "registration_statement_base64url": {
                "type": "string"
              },
              "statement_verified": {
                "type": "boolean"
              },
              "receipt_base64url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "receipt_profile": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "receipt_verified": {
                "type": "boolean"
              },
              "service_key_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "attempt_count": {
                "type": "integer",
                "minimum": 0
              },
              "last_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "DecisionChainRequest": {
        "type": "object",
        "properties": {
          "chain_id": {
            "type": "string",
            "format": "uuid",
            "description": "Existing chain to append to. Optional when parent references are supplied."
          },
          "workflow_id": {
            "type": "string",
            "description": "Customer workflow or execution instance identifier."
          },
          "step_id": {
            "type": "string",
            "description": "Current workflow step being evaluated."
          },
          "sequence": {
            "type": "integer",
            "minimum": 0
          },
          "parent_evaluation_ids": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "parent_dossier_ids": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "DecisionChainSummary": {
        "type": "object",
        "required": [
          "chain_id",
          "workflow_id",
          "step_id",
          "root_evaluation_id",
          "parent_evaluation_ids",
          "parent_dossier_ids",
          "lineage_depth",
          "integrity_hash",
          "chain_api_path"
        ],
        "properties": {
          "chain_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_id": {
            "type": "string"
          },
          "step_id": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "nullable": true
          },
          "root_evaluation_id": {
            "type": "string",
            "format": "uuid"
          },
          "parent_evaluation_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "parent_dossier_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "lineage_depth": {
            "type": "integer"
          },
          "integrity_hash": {
            "type": "string"
          },
          "chain_api_path": {
            "type": "string"
          },
          "authority_classification": {
            "$ref": "#/components/schemas/AuthorityClassification"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "ALLOW",
              "ESCALATE",
              "BLOCK"
            ]
          },
          "execution_binding_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        },
        "additionalProperties": false
      },
      "DecisionChainLink": {
        "type": "object",
        "required": [
          "id",
          "chain_id",
          "workflow_id",
          "step_id",
          "decision_evaluation_id",
          "dossier_id",
          "parent_evaluation_ids",
          "parent_dossier_ids",
          "root_evaluation_id",
          "lineage_depth",
          "integrity_hash",
          "integrity_verified",
          "dossier_api_path",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "chain_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_id": {
            "type": "string"
          },
          "step_id": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "nullable": true
          },
          "decision_evaluation_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "parent_evaluation_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "parent_dossier_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "root_evaluation_id": {
            "type": "string",
            "format": "uuid"
          },
          "lineage_depth": {
            "type": "integer"
          },
          "integrity_hash": {
            "type": "string"
          },
          "integrity_verified": {
            "type": "boolean"
          },
          "outcome": {
            "type": "string"
          },
          "policy_version": {
            "type": "string"
          },
          "authority_classification": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "AUTHORITATIVE",
              "OBSERVATIONAL",
              null
            ]
          },
          "verdict": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "ALLOW",
              "ESCALATE",
              "BLOCK",
              null
            ]
          },
          "execution_binding_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "dossier_api_path": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "DecisionChainEvidenceReference": {
        "type": "object",
        "additionalProperties": false,
        "description": "Privacy-safe reference to append-only execution evidence correlated with a Decision Chain. The audit ledger remains the evidence store; this object carries commitments and provenance, never raw provider payloads. DISPATCH appears only when a connected executor records dispatch evidence.",
        "required": [
          "stage",
          "evaluation_id",
          "dossier_id",
          "status",
          "occurred_at",
          "ledger_entry_id",
          "ledger_entry_hash",
          "evidence_digest",
          "evidence_hash_verified",
          "execution_correlation_id",
          "binding_digest",
          "observed_at",
          "observation_method",
          "observer",
          "expected_effect_digest",
          "observed_effect_digest",
          "evidence_reference"
        ],
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "CLAIM",
              "DISPATCH",
              "FINALIZATION",
              "EFFECT"
            ]
          },
          "evaluation_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "ledger_entry_id": {
            "type": "string",
            "format": "uuid"
          },
          "ledger_entry_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "evidence_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "evidence_hash_verified": {
            "type": "boolean",
            "description": "True when the evidence hash recorded in the ledger payload matches the canonical evidence fields projected into this reference."
          },
          "execution_correlation_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "binding_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "observation_method": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          },
          "observer": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "id",
                  "version"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "version": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 500
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_effect_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "observed_effect_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "evidence_reference": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 2000
          }
        }
      },
      "DecisionChain": {
        "type": "object",
        "required": [
          "service",
          "protocol_version",
          "org_id",
          "chain_id",
          "count",
          "max_lineage_depth",
          "integrity_verified",
          "ledger_verification",
          "links",
          "link_limit",
          "links_truncated",
          "evidence_lineage",
          "evidence_lineage_limit",
          "evidence_lineage_truncated"
        ],
        "properties": {
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "chain_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_id": {
            "type": "string",
            "nullable": true
          },
          "root_evaluation_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "count": {
            "type": "integer"
          },
          "max_lineage_depth": {
            "type": "integer"
          },
          "integrity_verified": {
            "type": "boolean"
          },
          "ledger_verification": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "valid",
              "complete",
              "checked",
              "max_entries"
            ],
            "description": "Bounded canonical-ledger verification performed for this response. `complete: false` means the response must not be treated as verified, even when the checked prefix contained no broken link.",
            "properties": {
              "valid": {
                "type": "boolean"
              },
              "complete": {
                "type": "boolean"
              },
              "checked": {
                "type": "integer",
                "minimum": 0
              },
              "max_entries": {
                "type": "integer",
                "minimum": 1,
                "maximum": 50000
              }
            }
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DecisionChainLink"
            }
          },
          "link_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "description": "Maximum Decision Chain links returned in this bounded projection."
          },
          "links_truncated": {
            "type": "boolean",
            "description": "True when additional Decision Chain links exist. A truncated response must not be interpreted as verification of the complete chain."
          },
          "evidence_lineage": {
            "type": "array",
            "description": "Claim, optional dispatch, finalization, and effect-evidence commitments correlated from canonical append-only audit-ledger membership and a cryptographically verified ExecutionBinding.",
            "items": {
              "$ref": "#/components/schemas/DecisionChainEvidenceReference"
            }
          },
          "evidence_lineage_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "description": "Maximum canonical audit-ledger entries considered by this projection."
          },
          "evidence_lineage_truncated": {
            "type": "boolean",
            "description": "True when additional chain-correlated ledger entries exist. In that case evidence_lineage is withheld so a bounded prefix is not presented as complete authoritative lineage."
          }
        },
        "additionalProperties": false
      },
      "ShadowEvaluateDecisionReport": {
        "type": "object",
        "required": [
          "evaluation_id",
          "dossier_id",
          "created_at",
          "decision_type",
          "policy_version",
          "mode",
          "outcome",
          "confidence",
          "would_execute",
          "execution_action",
          "reason",
          "dossier_api_path"
        ],
        "properties": {
          "evaluation_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "decision_type": {
            "type": "string"
          },
          "decision_domain": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "nullable": true
          },
          "risk_score": {
            "type": "number",
            "nullable": true
          },
          "channel": {
            "type": "string",
            "nullable": true
          },
          "policy_version": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "APPROVE",
              "ESCALATE",
              "REJECT",
              "REVIEW"
            ]
          },
          "confidence": {
            "type": "number"
          },
          "would_execute": {
            "type": "boolean"
          },
          "execution_action": {
            "type": "string",
            "enum": [
              "CONTINUE",
              "STOP",
              "HAND_OFF",
              "REVIEW"
            ]
          },
          "reason": {
            "type": "string"
          },
          "policy_guard_reason": {
            "type": "string",
            "nullable": true
          },
          "policy_evaluation_resolution": {
            "type": "string",
            "nullable": true
          },
          "selected_rule_id": {
            "type": "string",
            "nullable": true
          },
          "dossier_api_path": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ShadowEvaluateDecisionReportSummary": {
        "type": "object",
        "required": [
          "total_evaluations",
          "would_approve_count",
          "would_block_count",
          "would_escalate_count",
          "review_required_count",
          "non_approve_count",
          "non_approve_rate",
          "policy_mismatch_count",
          "policy_mismatch_rate",
          "near_miss_count",
          "near_miss_rate"
        ],
        "properties": {
          "total_evaluations": {
            "type": "integer"
          },
          "would_approve_count": {
            "type": "integer"
          },
          "would_block_count": {
            "type": "integer"
          },
          "would_escalate_count": {
            "type": "integer"
          },
          "review_required_count": {
            "type": "integer"
          },
          "non_approve_count": {
            "type": "integer"
          },
          "non_approve_rate": {
            "type": "number"
          },
          "policy_mismatch_count": {
            "type": "integer"
          },
          "policy_mismatch_rate": {
            "type": "number"
          },
          "near_miss_count": {
            "type": "integer"
          },
          "near_miss_rate": {
            "type": "number"
          },
          "outcome_counts": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "top_decision_types": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "top_reason_patterns": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": false
      },
      "ShadowEvaluateDecisionReportsResponse": {
        "type": "object",
        "required": [
          "service",
          "protocol_version",
          "generated_at",
          "org_id",
          "mode",
          "count",
          "reports",
          "summary"
        ],
        "properties": {
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ]
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "count": {
            "type": "integer"
          },
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShadowEvaluateDecisionReport"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/ShadowEvaluateDecisionReportSummary"
          }
        },
        "additionalProperties": false
      },
      "ShadowEvaluateDecisionReportsSummaryResponse": {
        "type": "object",
        "required": [
          "service",
          "protocol_version",
          "generated_at",
          "org_id",
          "mode",
          "summary"
        ],
        "properties": {
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHADOW",
              "PARALLEL",
              "ENFORCEMENT"
            ]
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "summary": {
            "$ref": "#/components/schemas/ShadowEvaluateDecisionReportSummary"
          }
        },
        "additionalProperties": false
      },
      "DecisionSignature": {
        "type": "object",
        "required": [
          "algorithm",
          "value"
        ],
        "properties": {
          "algorithm": {
            "type": "string",
            "enum": [
              "Ed25519"
            ]
          },
          "value": {
            "type": "string",
            "description": "Base64, base64url, or hex encoded signature bytes."
          }
        }
      },
      "DecisionResponse": {
        "type": "object",
        "required": [
          "decision_id",
          "status",
          "reason_codes",
          "explanation"
        ],
        "properties": {
          "decision_id": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/DecisionStatus"
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "explanation": {
            "type": "string"
          },
          "dossier_url": {
            "type": "string",
            "format": "uri"
          },
          "signature": {
            "$ref": "#/components/schemas/DecisionSignature"
          },
          "latency_ms": {
            "type": "integer",
            "minimum": 0
          }
        },
        "additionalProperties": true
      },
      "DecisionDossier": {
        "type": "object",
        "properties": {
          "decision_id": {
            "type": "string"
          },
          "dossier_url": {
            "type": "string",
            "format": "uri"
          },
          "status": {
            "$ref": "#/components/schemas/DecisionStatus"
          },
          "audit_events": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true
      },
      "PolicyValidationResponse": {
        "type": "object",
        "required": [
          "valid"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "PolicyBundle": {
        "type": "object",
        "required": [
          "protocol_version",
          "bundle_id",
          "org_id",
          "version",
          "effective_from",
          "rules"
        ],
        "properties": {
          "protocol_version": {
            "type": "string",
            "pattern": "^1\\.[0-9]+(\\.[0-9]+)?$"
          },
          "bundle_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          },
          "effective_to": {
            "type": "string",
            "format": "date-time"
          },
          "rules": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/PolicyRule"
            }
          },
          "allowed_transitions": {
            "type": "array",
            "maxItems": 50,
            "description": "Which states a decision type's target may move between, checked before any rule. For a decision of `decision_type`, the move from the state at the fact path `from` (typically `agent_safe.precondition.state`) to the state at `to` must be one of `allowed`, exactly as written, or the evaluation resolves `transition_not_allowed` and the outcome is REJECT. No value at `to` asks for no state, and `to` equal to `from` is no transition. A `from` or `to` that is not a string fails safe to ESCALATE as `missing_required_signals`. A bundle declaring any is signed for the edge as `core_abi: 8`.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "transition_id",
                "decision_type",
                "from",
                "to",
                "allowed"
              ],
              "properties": {
                "transition_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "decision_type": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "from": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "to": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "allowed": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 200,
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "from",
                      "to"
                    ],
                    "properties": {
                      "from": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "to": {
                        "type": "string",
                        "maxLength": 200
                      }
                    }
                  }
                },
                "rationale": {
                  "type": "string",
                  "maxLength": 4000
                }
              }
            }
          },
          "metadata": {
            "type": "object",
            "properties": {
              "author": {
                "type": "string"
              },
              "source": {
                "type": "string"
              },
              "change_ticket": {
                "type": "string"
              },
              "signal_admission": {
                "$ref": "#/components/schemas/SemanticSignalAdmissionPolicy"
              }
            },
            "additionalProperties": false
          },
          "signature": {
            "type": "object",
            "properties": {
              "algo": {
                "type": "string"
              },
              "digest": {
                "type": "string"
              },
              "signed_at": {
                "type": "string",
                "format": "date-time"
              },
              "signed_by": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "commerce_preflight": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-preflight-v2"
              },
              "max_fact_age_seconds": {
                "type": "integer",
                "minimum": 1,
                "maximum": 86400
              },
              "allowed_sources": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120,
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
                },
                "minItems": 1,
                "maxItems": 100
              },
              "checks": {
                "type": "object",
                "properties": {
                  "P01": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "floor_percent": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100
                          }
                        },
                        "required": [
                          "enabled",
                          "floor_percent"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P02": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "tolerance_percent": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100
                          }
                        },
                        "required": [
                          "enabled",
                          "tolerance_percent"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P03": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "minimum_available": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 1000000000
                          }
                        },
                        "required": [
                          "enabled",
                          "minimum_available"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P04": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "allow",
                              "block"
                            ]
                          },
                          "countries": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[A-Z]{2}$"
                            },
                            "maxItems": 250
                          }
                        },
                        "required": [
                          "enabled",
                          "mode",
                          "countries"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P05": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "max_concurrent_discounts": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 32
                          }
                        },
                        "required": [
                          "enabled",
                          "max_concurrent_discounts"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P06": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "tolerance_percent": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100
                          }
                        },
                        "required": [
                          "enabled",
                          "tolerance_percent"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P07": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "max_redemptions": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000000
                          },
                          "new_account_age_days": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100000
                          }
                        },
                        "required": [
                          "enabled",
                          "max_redemptions",
                          "new_account_age_days"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P08": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P09": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "amount": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1000000000000
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          }
                        },
                        "required": [
                          "enabled",
                          "amount",
                          "currency"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P10": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "max_prior_refunds": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 1000000000
                          }
                        },
                        "required": [
                          "enabled",
                          "max_prior_refunds"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P11": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "return_window_days": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 3650
                          }
                        },
                        "required": [
                          "enabled",
                          "return_window_days"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P12": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "unattended_limit": {
                            "type": "object",
                            "properties": {
                              "amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              }
                            },
                            "required": [
                              "amount",
                              "currency"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "enabled",
                          "unattended_limit"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P13": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P14": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "window_days": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 3650
                          }
                        },
                        "required": [
                          "enabled",
                          "window_days"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P15": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "floor": {
                            "type": "object",
                            "properties": {
                              "amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              }
                            },
                            "required": [
                              "amount",
                              "currency"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "enabled",
                          "floor"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "P16": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "const": true
                          },
                          "minimum_annualized_yield_percent": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100
                          }
                        },
                        "required": [
                          "enabled",
                          "minimum_annualized_yield_percent"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "max_fact_age_seconds",
              "allowed_sources",
              "checks"
            ],
            "additionalProperties": false
          },
          "commerce_history": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-marketplace-history-policy-v1"
              },
              "price_reference": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "recorded_order_original_price"
                  },
                  "max_markdown_percent": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  }
                },
                "required": [
                  "kind",
                  "max_markdown_percent"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "price_reference"
            ],
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "SemanticSignalAdmissionPolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "Deterministic trust gate for typed semantic evidence.",
        "properties": {
          "allowed_producers": {
            "type": "array",
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "allowed_detector_versions": {
            "type": "array",
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "require_evidence_digest": {
            "type": "boolean"
          },
          "minimum_confidence_basis_points": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "required_signal_paths": {
            "type": "array",
            "maxItems": 50,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "on_failure": {
            "type": "string",
            "enum": [
              "ESCALATE",
              "AUTO_REJECT"
            ]
          }
        }
      },
      "SemanticSignalEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schema_version",
          "signal_id",
          "kind",
          "value",
          "producer",
          "observed_at",
          "confidence_basis_points",
          "evidence_digest",
          "value_digest",
          "material"
        ],
        "properties": {
          "schema_version": {
            "type": "string",
            "const": "1.0"
          },
          "signal_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "kind": {
            "type": "string",
            "pattern": "^(intent_risk|scope_drift|data_sensitivity|suspected_exfiltration|[a-z0-9][a-z0-9.-]{0,62}:[a-z0-9][a-z0-9._-]{0,119})$"
          },
          "value": {},
          "producer": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "provider",
              "detector_version"
            ],
            "properties": {
              "provider": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "detector_version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            }
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "confidence_basis_points": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "evidence_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "value_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "material": {
            "type": "boolean"
          }
        }
      },
      "PersistedSemanticSignalMetadata": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schema_version",
          "signal_id",
          "kind",
          "detector_version",
          "observed_at",
          "confidence_basis_points",
          "evidence_digest",
          "value_digest",
          "material"
        ],
        "properties": {
          "schema_version": {
            "type": "string",
            "const": "1.0"
          },
          "signal_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "kind": {
            "type": "string",
            "pattern": "^(intent_risk|scope_drift|data_sensitivity|suspected_exfiltration|[a-z0-9][a-z0-9.-]{0,62}:[a-z0-9][a-z0-9._-]{0,119})$"
          },
          "detector_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "confidence_basis_points": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "evidence_digest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "value_digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "material": {
            "type": "boolean"
          }
        }
      },
      "ProtocolSignalEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "protocol_version",
          "envelope_id",
          "org_id",
          "source",
          "domain",
          "metric_name",
          "metric_type",
          "value",
          "recorded_at",
          "ingested_at"
        ],
        "properties": {
          "protocol_version": {
            "type": "string",
            "pattern": "^1\\.[0-9]+(\\.[0-9]+)?$"
          },
          "envelope_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string"
          },
          "source": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "provider",
              "mode"
            ],
            "properties": {
              "provider": {
                "type": "string"
              },
              "connector_id": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "DIRECT_API",
                  "CUSTOMER_INFRA",
                  "WEBHOOK",
                  "MANUAL"
                ]
              }
            }
          },
          "domain": {
            "type": "string"
          },
          "metric_name": {
            "type": "string"
          },
          "metric_type": {
            "type": "string",
            "enum": [
              "gauge",
              "counter",
              "event",
              "categorical"
            ]
          },
          "value": {},
          "unit": {
            "type": "string"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "ingested_at": {
            "type": "string",
            "format": "date-time"
          },
          "dimensions": {
            "type": "object",
            "additionalProperties": true
          },
          "semantic": {
            "$ref": "#/components/schemas/PersistedSemanticSignalMetadata"
          },
          "evidence": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            }
          },
          "trace": {
            "type": "object",
            "additionalProperties": true
          },
          "hash": {
            "type": "string",
            "pattern": "^[A-Fa-f0-9]{64}$"
          }
        }
      },
      "PolicyRule": {
        "type": "object",
        "required": [
          "rule_id",
          "name",
          "decision_domain",
          "when",
          "then",
          "priority",
          "enabled"
        ],
        "properties": {
          "rule_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "decision_domain": {
            "type": "string"
          },
          "when": {
            "type": "object",
            "additionalProperties": true
          },
          "then": {
            "type": "object",
            "required": [
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "REQUIRE_REVIEW",
                  "AUTO_APPROVE",
                  "AUTO_REJECT",
                  "ESCALATE",
                  "REQUEST_INFO"
                ]
              },
              "severity": {
                "type": "string",
                "enum": [
                  "routine",
                  "elevated",
                  "urgent"
                ]
              },
              "assignee_role": {
                "type": "string"
              },
              "sla_minutes": {
                "type": "integer",
                "minimum": 1
              },
              "authority": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "reason_codes",
                  "selector",
                  "verification_requirements",
                  "resolution",
                  "expires_in_seconds"
                ],
                "properties": {
                  "reason_codes": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Z0-9_]{1,119}$"
                    }
                  },
                  "selector": {
                    "$ref": "#/components/schemas/AuthoritySelector"
                  },
                  "verification_requirements": {
                    "$ref": "#/components/schemas/AuthorityVerificationRequirements"
                  },
                  "resolution": {
                    "$ref": "#/components/schemas/AuthorityResolutionPolicy"
                  },
                  "expires_in_seconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 3600
                  }
                }
              }
            },
            "additionalProperties": false
          },
          "priority": {
            "type": "integer"
          },
          "enabled": {
            "type": "boolean"
          },
          "rationale": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "PolicyDraftSource": {
        "type": "object",
        "required": [
          "label",
          "source_type"
        ],
        "description": "One manual policy source. Provide `content` (inline text) or\n`content_base64` (file bytes; text is extracted server-side from PDF,\nXLSX, XML, HTML, JSON, and plain-text documents such as transaction\nor audit logs).\n",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 200
          },
          "source_type": {
            "type": "string",
            "maxLength": 80,
            "description": "Caller-chosen tag, e.g. upload, jira, confluence, audit_log."
          },
          "content": {
            "type": "string",
            "maxLength": 250000
          },
          "content_base64": {
            "type": "string",
            "maxLength": 10000000
          },
          "content_type": {
            "type": "string",
            "maxLength": 200
          },
          "file_name": {
            "type": "string",
            "maxLength": 300
          },
          "external_reference": {
            "type": "string",
            "maxLength": 500
          }
        },
        "additionalProperties": false
      },
      "PolicyDraftRequest": {
        "type": "object",
        "description": "Provide manual sources, live connector ids, or both — at least one of the two is required.\n",
        "properties": {
          "suggested_name": {
            "type": "string",
            "maxLength": 160
          },
          "workflow_key": {
            "type": "string",
            "maxLength": 120
          },
          "sources": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/PolicyDraftSource"
            }
          },
          "live_connector_ids": {
            "type": "array",
            "maxItems": 6,
            "description": "Org policy-source connectors to pull live at draft time (Jira, Confluence, Notion, Google Drive, Git repository, SAP).\n",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "additionalProperties": false
      },
      "PolicyStrategyDraftResponse": {
        "type": "object",
        "required": [
          "org",
          "generated_at",
          "draft"
        ],
        "properties": {
          "org": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "draft": {
            "type": "object",
            "required": [
              "used_llm",
              "suggested_name",
              "workflow_key",
              "summary",
              "strategy"
            ],
            "properties": {
              "used_llm": {
                "type": "boolean"
              },
              "suggested_name": {
                "type": "string"
              },
              "workflow_key": {
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "strategy": {
                "type": "object",
                "description": "The strategy-shaped draft, including `strategy_rules` with clauses bucketed for automatic execution, escalation, and blocking.\n",
                "additionalProperties": true
              },
              "extracted_sources": {
                "type": "array",
                "items": {}
              },
              "review_checklist": {
                "type": "array",
                "items": {}
              },
              "open_questions": {
                "type": "array",
                "items": {}
              },
              "warnings": {
                "type": "array",
                "items": {}
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "PolicyPackDraftResponse": {
        "type": "object",
        "required": [
          "org",
          "generated_at",
          "pack_id",
          "draft"
        ],
        "properties": {
          "org": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "pack_id": {
            "type": "string",
            "format": "uuid",
            "description": "The persisted draft pack, ready for review and finalization."
          },
          "draft": {
            "type": "object",
            "required": [
              "used_llm",
              "suggested_name",
              "workflow_key",
              "pack",
              "review"
            ],
            "properties": {
              "status": {
                "type": "string"
              },
              "used_llm": {
                "type": "boolean"
              },
              "suggested_name": {
                "type": "string"
              },
              "workflow_key": {
                "type": "string"
              },
              "pack": {
                "type": "object",
                "description": "The executable pack: compiler-validated rules of the shape `{ name, all|any: [{field, op, value}], action }` with action one of allow, block, restrain, escalate.\n",
                "properties": {
                  "rules": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "additionalProperties": true
              },
              "source_summary": {
                "type": "array",
                "items": {}
              },
              "review": {
                "type": "array",
                "description": "Clauses that could not become executable predicates — returned for human review instead of being synthesized into rules.\n",
                "items": {}
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "ArtifactAcceptedResponse": {
        "type": "object",
        "required": [
          "accepted",
          "service",
          "protocol_version",
          "artifact",
          "artifact_id",
          "org_id",
          "received_at"
        ],
        "properties": {
          "accepted": {
            "type": "boolean"
          },
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "artifact": {
            "type": "string",
            "enum": [
              "policy_bundle",
              "signal_envelope"
            ]
          },
          "artifact_id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "HealthResponse": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "examples": [
              "ok"
            ]
          },
          "version": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          }
        }
      },
      "OpsGateRequest": {
        "type": "object",
        "description": "A spend/disbursement payload for the ops spend-control vertical pack.",
        "properties": {
          "object_type": {
            "type": "string",
            "examples": [
              "Expense",
              "VendorPayment",
              "Refund",
              "Credit"
            ]
          },
          "object_id": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "proposed_state": {
            "type": "object",
            "description": "amount, currency, vendor_id, invoice_number, vendor_status, expense_threshold, refund_limit, credit_limit, etc.",
            "additionalProperties": true
          },
          "actor": {
            "type": "object",
            "description": "The acting principal and its role (e.g. role Controller or CFO).",
            "additionalProperties": true
          },
          "context": {
            "type": "object",
            "description": "requested_by, approved_by, second_approver, org_id, etc.",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "OpsGateVerdict": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "ALLOW",
              "BLOCK",
              "ESCALATE",
              "DELAY"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "APPROVE",
              "REJECT",
              "ESCALATE",
              "REVIEW"
            ]
          },
          "reason": {
            "type": "string"
          },
          "required_action": {
            "type": [
              "string",
              "null"
            ]
          },
          "gate": {
            "type": "string",
            "enum": [
              "spend_admission",
              "disbursement_authority"
            ]
          },
          "decision_domain": {
            "type": "string",
            "enum": [
              "OPS_SPEND_ADMISSION",
              "OPS_DISBURSEMENT_AUTHORITY"
            ]
          },
          "rule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "duplicate_suspected": {
            "type": "boolean"
          },
          "policy_version": {
            "type": "string"
          },
          "dossier_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "dossier_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "federated": {
            "type": "boolean"
          },
          "pipeline": {
            "type": "boolean"
          },
          "idempotent_replay": {
            "type": "boolean"
          }
        },
        "additionalProperties": true
      },
      "SurfaceDecisionRequest": {
        "type": "object",
        "required": [
          "surface",
          "decision",
          "dossier_id",
          "dossier_sha256"
        ],
        "properties": {
          "surface": {
            "type": "string",
            "examples": [
              "amazon",
              "ebay",
              "shopify"
            ]
          },
          "decision": {
            "type": "string",
            "enum": [
              "authorize",
              "block",
              "review"
            ]
          },
          "dossier_id": {
            "type": "string"
          },
          "dossier_sha256": {
            "type": "string"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "shadow",
              "enforced"
            ]
          },
          "dossier": {
            "type": "object",
            "description": "The full signed surface dossier. When present it is persisted and made exportable as a proof packet; when omitted only a ledger entry is appended.",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "SurfaceDecisionResponse": {
        "type": "object",
        "properties": {
          "federated": {
            "type": "boolean"
          },
          "persisted": {
            "type": "boolean"
          },
          "surface": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "dossier_id": {
            "type": "string"
          },
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_error": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": true
      },
      "EbayChallengeResponse": {
        "type": "object",
        "required": [
          "challengeResponse"
        ],
        "properties": {
          "challengeResponse": {
            "type": "string",
            "description": "Hex SHA-256 of challengeCode + verificationToken + endpointURL."
          }
        }
      },
      "MarketplaceDeletionNotification": {
        "type": "object",
        "description": "eBay account-deletion notification payload (subset Decionis reads).",
        "properties": {
          "metadata": {
            "type": "object",
            "properties": {
              "topic": {
                "type": "string"
              },
              "schemaVersion": {
                "type": "string"
              }
            },
            "additionalProperties": true
          },
          "notification": {
            "type": "object",
            "properties": {
              "notificationId": {
                "type": "string"
              },
              "data": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string"
                  },
                  "userId": {
                    "type": "string"
                  },
                  "eiasToken": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "DecisionDossierProofPacket": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "packet_type": {
            "type": "string",
            "examples": [
              "decionis.decision_dossier.proof_packet"
            ]
          },
          "packet_version": {
            "type": "string"
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "subject": {
            "type": "object",
            "properties": {
              "org_id": {
                "type": "string"
              },
              "dossier_id": {
                "type": "string"
              }
            }
          },
          "dossier": {
            "type": "object",
            "additionalProperties": true
          },
          "policy_snapshot": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "ledger_anchor": {
            "type": "object",
            "additionalProperties": true
          },
          "proof_bundle": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "verification": {
            "type": "object",
            "description": "signature_verified, policy_snapshot_verified, chain_integrity_verified, proof_bundle_verified, and overall (VERIFIED | PARTIAL | UNVERIFIED).",
            "additionalProperties": true
          },
          "verify_instructions": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "DecisionChainProofPacket": {
        "type": "object",
        "description": "Backward-compatible schema name for the authenticated Decision Chain verification report. The response is not signed, portable, or independently verifiable offline because source dossier and ledger bytes are not embedded.",
        "properties": {
          "service": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "packet_type": {
            "type": "string",
            "examples": [
              "decionis.decision_chain.proof_packet"
            ]
          },
          "packet_version": {
            "type": "string"
          },
          "report_semantics": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "verification_mode",
              "response_signed",
              "source_evidence_embedded",
              "portable",
              "offline_verifiable",
              "steps"
            ],
            "properties": {
              "verification_mode": {
                "type": "string",
                "const": "SERVER_STATE_AT_ISSUED_AT"
              },
              "response_signed": {
                "type": "boolean",
                "const": false
              },
              "source_evidence_embedded": {
                "type": "boolean",
                "const": false
              },
              "portable": {
                "type": "boolean",
                "const": false
              },
              "offline_verifiable": {
                "type": "boolean",
                "const": false
              },
              "steps": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "subject": {
            "type": "object",
            "properties": {
              "org_id": {
                "type": "string"
              },
              "chain_id": {
                "type": "string"
              }
            }
          },
          "chain": {
            "type": "object",
            "additionalProperties": true
          },
          "ledger_anchor": {
            "type": "object",
            "additionalProperties": true
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "overall": {
            "type": "string",
            "description": "Point-in-time server verification result, not a signature over this response.",
            "enum": [
              "VERIFIED",
              "PARTIAL",
              "UNVERIFIED"
            ]
          },
          "verify_instructions": {
            "type": "object",
            "description": "Explains the server-report boundary and how to obtain source evidence.",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "AgentProvisionRequest": {
        "type": "object",
        "properties": {
          "agent_name": {
            "type": "string",
            "maxLength": 64,
            "description": "Optional display name for the workspace, shown to the claiming owner."
          }
        },
        "additionalProperties": false
      },
      "AgentProvisionLimits": {
        "type": "object",
        "description": "The caps on the anonymous lane, echoed so agents plan around them.",
        "properties": {
          "requests_per_minute": {
            "type": "integer",
            "examples": [
              10
            ]
          },
          "workspaces_per_network_per_day": {
            "type": "integer",
            "examples": [
              5
            ]
          },
          "governed_decisions_per_month": {
            "type": "integer",
            "examples": [
              50
            ]
          },
          "workspaces_service_wide_per_day": {
            "type": "integer",
            "description": "Service-wide daily ceiling across every network (present only when the deployment enables one). When minting answers 429 with PROVISION_LIMIT_REACHED and Retry-After, claim an existing workspace instead of retrying from a new address."
          }
        },
        "additionalProperties": true
      },
      "AgentProvisionResponse": {
        "type": "object",
        "required": [
          "org_id",
          "raw_key",
          "provisional",
          "limits",
          "claim",
          "next"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "raw_key": {
            "type": "string",
            "description": "The workspace's org API key. Returned exactly once — store it."
          },
          "provisional": {
            "type": "boolean",
            "description": "Always true at mint; the workspace stays provisional until claimed."
          },
          "limits": {
            "$ref": "#/components/schemas/AgentProvisionLimits"
          },
          "claim": {
            "type": "object",
            "description": "How to attach a human owner — the claim/start and claim/verify endpoints prefilled for this org, plus the note to surface to your operator. The key and dossier ledger survive the claim.",
            "additionalProperties": true
          },
          "next": {
            "type": "object",
            "description": "Suggested next calls, starting with a shadow-mode evaluate-decision.",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "PublicDossierVerificationResponse": {
        "type": "object",
        "required": [
          "service",
          "verified",
          "cryptographically_verified",
          "execution_eligible",
          "execution_authority",
          "generated_at",
          "verification_status",
          "proof_bundle",
          "dossier",
          "integrity"
        ],
        "properties": {
          "service": {
            "type": "string",
            "examples": [
              "decionis"
            ]
          },
          "verified": {
            "type": "boolean",
            "description": "Compatibility result. Protocol 1.0 artifacts retain their original share-link verification semantics. When an Ed25519 proof bundle is present this equals its cryptographic signature result. This field is not an execution-eligibility statement."
          },
          "cryptographically_verified": {
            "type": "boolean",
            "description": "True only when every listed proof artifact verified against the published Ed25519 JWKS. This does not by itself establish execution eligibility."
          },
          "execution_eligible": {
            "type": "boolean",
            "description": "True only for a cryptographically valid Protocol 1.1 authoritative ALLOW whose required execution-authority artifacts and semantic commitments are proof-covered."
          },
          "execution_authority": {
            "type": "object",
            "required": [
              "protocol_version",
              "required_artifact_coverage_verified",
              "authority_classification",
              "execution_eligible"
            ],
            "properties": {
              "protocol_version": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1,
                "maxLength": 120,
                "description": "Signed protocol declaration when present. Historical, future, or otherwise unsupported values are echoed for diagnosis but never promoted to Protocol 1.1 execution eligibility."
              },
              "required_artifact_coverage_verified": {
                "type": "boolean"
              },
              "authority_classification": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AuthorityClassification"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "execution_eligible": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "verification_status": {
            "type": "object",
            "description": "Per-check breakdown — signature, policy snapshot, ledger chain, proof bundle — each with verified, severity, and detail.",
            "additionalProperties": true
          },
          "proof_bundle": {
            "type": "object",
            "description": "Ed25519 verification detail, the JWKS URL, and a self_verify command anyone can run offline with @decionis/verify.",
            "additionalProperties": true
          },
          "dossier": {
            "type": "object",
            "description": "Share-safe public projection. Categorical tokens pass; caller- minted values and identifiers are masked server-side; the policy snapshot is proven and pinned by hash but never shipped.",
            "additionalProperties": true
          },
          "integrity": {
            "type": "object",
            "additionalProperties": true
          },
          "verification": {
            "type": "object",
            "description": "Fresh expiring share links for this dossier (v2, org-scoped).",
            "additionalProperties": true
          },
          "signal_trace": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "overrides": {
            "type": "object",
            "additionalProperties": true
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "PublicDossierProofBundleResponse": {
        "type": "object",
        "required": [
          "service",
          "dossier_id",
          "dossier_payload",
          "jwks_url"
        ],
        "properties": {
          "service": {
            "type": "string",
            "examples": [
              "decionis"
            ]
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_payload": {
            "type": "object",
            "description": "Only what verification needs — the signed documents at their JSON-pointer paths plus integrity.proof_bundle. Nothing else from the dossier payload.",
            "additionalProperties": true
          },
          "jwks_url": {
            "type": "string",
            "format": "uri"
          },
          "jwks_path": {
            "type": "string"
          },
          "verify_with": {
            "type": "object",
            "description": "The exact npx @decionis/verify command for this bundle.",
            "additionalProperties": true
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "PublicDossierReproduceResponse": {
        "type": "object",
        "required": [
          "service",
          "dossier_id",
          "reproduction"
        ],
        "properties": {
          "service": {
            "type": "string",
            "examples": [
              "decionis"
            ]
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "reproduction": {
            "type": "object",
            "description": "The deterministic re-run result — same inputs plus same policy bundle, compared against the recorded verdict.",
            "additionalProperties": true
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "OrgClaimStartRequest": {
        "type": "object",
        "required": [
          "owner_email"
        ],
        "properties": {
          "owner_email": {
            "type": "string",
            "format": "email",
            "maxLength": 200
          }
        },
        "additionalProperties": false
      },
      "OrgClaimStartResponse": {
        "type": "object",
        "required": [
          "verification"
        ],
        "properties": {
          "verification": {
            "type": "object",
            "required": [
              "channel",
              "owner_email",
              "expires_at"
            ],
            "properties": {
              "channel": {
                "type": "string",
                "enum": [
                  "email"
                ]
              },
              "owner_email": {
                "type": "string",
                "format": "email"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "email_sent": {
                "type": "boolean"
              },
              "email_delivery_mode": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "OrgClaimVerifyRequest": {
        "type": "object",
        "required": [
          "owner_email",
          "otp_code"
        ],
        "properties": {
          "owner_email": {
            "type": "string",
            "format": "email",
            "maxLength": 200
          },
          "otp_code": {
            "type": "string",
            "pattern": "^\\d{6}$"
          },
          "password": {
            "type": "string",
            "minLength": 8,
            "maxLength": 256,
            "description": "Required only when the email has no existing account — it becomes sign-in."
          },
          "name": {
            "type": "string",
            "maxLength": 200
          }
        },
        "additionalProperties": false
      },
      "OrgClaimVerifyResponse": {
        "type": "object",
        "required": [
          "claimed",
          "org",
          "user"
        ],
        "properties": {
          "claimed": {
            "type": "boolean"
          },
          "org": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "additionalProperties": true
          },
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "additionalProperties": true
          },
          "existing_user": {
            "type": "boolean"
          },
          "next": {
            "type": "object",
            "description": "Workspace and onboarding paths for the newly attached owner.",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "OrgVerificationLinkRotationResponse": {
        "type": "object",
        "required": [
          "rotated",
          "verification_link_secret_version"
        ],
        "properties": {
          "rotated": {
            "type": "boolean"
          },
          "verification_link_secret_version": {
            "type": "integer",
            "description": "The new per-org secret version; freshly minted links use it."
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "CommercePreflightReadiness": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-preflight-readiness-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "maxLength": 40,
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])$"
          },
          "preflight_version": {
            "type": "string",
            "const": "commerce-preflight-v2"
          },
          "evaluator_version": {
            "type": "string",
            "const": "policy-graph/1.1+commerce-preflight/2.0"
          },
          "policy_resolution": {
            "type": "object",
            "properties": {
              "requested_policy_version": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolved_policy_version": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "exact_match",
                  "newest_active",
                  "requested_not_found",
                  "policy_guard"
                ]
              }
            },
            "required": [
              "requested_policy_version",
              "resolved_policy_version",
              "status"
            ],
            "additionalProperties": false
          },
          "selected_policy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "bundle_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "effective_from": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "maxLength": 40,
                        "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "effective_to": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "maxLength": 40,
                        "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rules_sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "parameters_sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "commerce_preflight_digest": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sha256:[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "bundle_id",
                  "version",
                  "effective_from",
                  "effective_to",
                  "rules_sha256",
                  "parameters_sha256",
                  "commerce_preflight_digest"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "configuration": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "commerce-preflight-v2"
                  },
                  "max_fact_age_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 86400
                  },
                  "allowed_sources": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
                    },
                    "minItems": 1,
                    "maxItems": 100
                  },
                  "checks": {
                    "type": "object",
                    "properties": {
                      "P01": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "floor_percent": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 100
                              }
                            },
                            "required": [
                              "enabled",
                              "floor_percent"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P02": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "tolerance_percent": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 100
                              }
                            },
                            "required": [
                              "enabled",
                              "tolerance_percent"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P03": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "minimum_available": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1000000000
                              }
                            },
                            "required": [
                              "enabled",
                              "minimum_available"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P04": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "allow",
                                  "block"
                                ]
                              },
                              "countries": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{2}$"
                                },
                                "maxItems": 250
                              }
                            },
                            "required": [
                              "enabled",
                              "mode",
                              "countries"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P05": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "max_concurrent_discounts": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 32
                              }
                            },
                            "required": [
                              "enabled",
                              "max_concurrent_discounts"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P06": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "tolerance_percent": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 100
                              }
                            },
                            "required": [
                              "enabled",
                              "tolerance_percent"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P07": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "max_redemptions": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 1000000000
                              },
                              "new_account_age_days": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 100000
                              }
                            },
                            "required": [
                              "enabled",
                              "max_redemptions",
                              "new_account_age_days"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P08": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P09": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              }
                            },
                            "required": [
                              "enabled",
                              "amount",
                              "currency"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P10": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "max_prior_refunds": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1000000000
                              }
                            },
                            "required": [
                              "enabled",
                              "max_prior_refunds"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P11": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "return_window_days": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 3650
                              }
                            },
                            "required": [
                              "enabled",
                              "return_window_days"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P12": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "unattended_limit": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1000000000000
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "enabled",
                              "unattended_limit"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P13": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P14": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "window_days": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 3650
                              }
                            },
                            "required": [
                              "enabled",
                              "window_days"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P15": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "floor": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1000000000000
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "enabled",
                              "floor"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "P16": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "enabled"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "const": true
                              },
                              "minimum_annualized_yield_percent": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 100
                              }
                            },
                            "required": [
                              "enabled",
                              "minimum_annualized_yield_percent"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "version",
                  "max_fact_age_seconds",
                  "allowed_sources",
                  "checks"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "P01",
                    "P02",
                    "P03",
                    "P04",
                    "P05",
                    "P06",
                    "P07",
                    "P08",
                    "P09",
                    "P10",
                    "P11",
                    "P12",
                    "P13",
                    "P14",
                    "P15",
                    "P16"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "enabled",
                    "disabled",
                    "missing",
                    "unsupported",
                    "unavailable"
                  ]
                }
              },
              "required": [
                "id",
                "status"
              ],
              "additionalProperties": false
            },
            "minItems": 16,
            "maxItems": 16
          },
          "counts": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "integer",
                "minimum": 0,
                "maximum": 16
              },
              "disabled": {
                "type": "integer",
                "minimum": 0,
                "maximum": 16
              },
              "missing": {
                "type": "integer",
                "minimum": 0,
                "maximum": 16
              },
              "unsupported": {
                "type": "integer",
                "minimum": 0,
                "maximum": 16
              },
              "unavailable": {
                "type": "integer",
                "minimum": 0,
                "maximum": 16
              }
            },
            "required": [
              "enabled",
              "disabled",
              "missing",
              "unsupported",
              "unavailable"
            ],
            "additionalProperties": false
          },
          "configuration_complete": {
            "type": "boolean"
          },
          "all_disabled": {
            "type": "boolean"
          },
          "diagnostics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "MISSING_ORG_POLICY_BUNDLE",
                    "NO_ACTIVE_ORG_POLICY_BUNDLE",
                    "REQUESTED_POLICY_BUNDLE_NOT_FOUND",
                    "COMMERCE_POLICY_MISSING",
                    "COMMERCE_POLICY_UNSUPPORTED",
                    "CHECK_POLICY_MISSING",
                    "ALL_CHECKS_DISABLED"
                  ]
                },
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200,
                  "pattern": "^[A-Za-z0-9_.]+$"
                }
              },
              "required": [
                "code",
                "path"
              ],
              "additionalProperties": false
            },
            "maxItems": 32
          }
        },
        "required": [
          "version",
          "org_id",
          "checked_at",
          "preflight_version",
          "evaluator_version",
          "policy_resolution",
          "selected_policy",
          "configuration",
          "checks",
          "counts",
          "configuration_complete",
          "all_disabled",
          "diagnostics"
        ],
        "additionalProperties": false
      },
      "CommercePreflightReadinessQuery": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        "required": [
          "org_id"
        ],
        "additionalProperties": false
      },
      "CommerceErpSources": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-erp-sources-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connections": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "connection_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "platform": {
                  "type": "string",
                  "const": "business-central"
                },
                "display_name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "environment_name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "revision": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "views": {
                  "type": "array",
                  "minItems": 2,
                  "maxItems": 2,
                  "items": [
                    {
                      "type": "string",
                      "const": "current_orders"
                    },
                    {
                      "type": "string",
                      "const": "posted_invoices"
                    }
                  ]
                },
                "history_available": {
                  "type": "boolean"
                }
              },
              "required": [
                "connection_id",
                "platform",
                "display_name",
                "environment_name",
                "revision",
                "views",
                "history_available"
              ],
              "additionalProperties": false
            },
            "maxItems": 20
          },
          "coverage": {
            "type": "object",
            "properties": {
              "connection_limit": {
                "type": "number",
                "const": 20
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": [
              "connection_limit",
              "truncated"
            ],
            "additionalProperties": false
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "connections",
          "coverage",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "CommerceErpOrders": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-erp-orders-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.business_central.read.v1"
              },
              "platform": {
                "type": "string",
                "const": "business-central"
              },
              "view": {
                "type": "string",
                "enum": [
                  "posted_invoices",
                  "current_orders"
                ]
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              },
              "window": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "days": {
                        "type": "number",
                        "const": 90
                      },
                      "start_date": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "end_date_exclusive": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "date_field": {
                        "type": "string",
                        "const": "postingDate"
                      },
                      "anchor": {
                        "type": "string",
                        "const": "server_utc_date"
                      }
                    },
                    "required": [
                      "days",
                      "start_date",
                      "end_date_exclusive",
                      "date_field",
                      "anchor"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "documents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "transaction_date": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "date_precision": {
                      "type": "string",
                      "const": "day"
                    },
                    "date_field": {
                      "type": "string",
                      "enum": [
                        "postingDate",
                        "orderDate"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "Draft",
                        "In Review",
                        "Open",
                        "Paid"
                      ]
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "currency_source": {
                      "type": "string",
                      "enum": [
                        "document",
                        "company",
                        "unavailable"
                      ]
                    },
                    "net_amount_excluding_tax": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000000
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "cost_basis": {
                      "type": "null"
                    },
                    "cost_currency": {
                      "type": "null"
                    },
                    "cost_provenance": {
                      "type": "string",
                      "const": "unavailable"
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "quantity": {
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "net_amount_excluding_tax": {
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "quantity",
                          "net_amount_excluding_tax"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 100
                    },
                    "lines_complete": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "transaction_date",
                    "date_precision",
                    "date_field",
                    "status",
                    "currency",
                    "currency_source",
                    "net_amount_excluding_tax",
                    "cost_basis",
                    "cost_currency",
                    "cost_provenance",
                    "lines",
                    "lines_complete"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 100
              },
              "coverage": {
                "type": "object",
                "properties": {
                  "document_limit": {
                    "type": "number",
                    "const": 100
                  },
                  "complete": {
                    "type": "boolean"
                  },
                  "truncated": {
                    "type": "boolean"
                  },
                  "lines_complete": {
                    "type": "boolean"
                  },
                  "reasons": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "historical_cost_unavailable",
                        "document_limit",
                        "line_limit",
                        "page_limit",
                        "duplicate_document",
                        "duplicate_line",
                        "date_excluded",
                        "status_excluded",
                        "currency_unavailable",
                        "amount_unavailable",
                        "response_limit"
                      ]
                    },
                    "maxItems": 12
                  }
                },
                "required": [
                  "document_limit",
                  "complete",
                  "truncated",
                  "lines_complete",
                  "reasons"
                ],
                "additionalProperties": false
              },
              "summary": {
                "type": "object",
                "properties": {
                  "documents_scanned": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "documents_returned": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "missing_cost": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "missing_currency": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "excluded_date": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "excluded_status": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "invalid_amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "excluded_lines": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  }
                },
                "required": [
                  "documents_scanned",
                  "documents_returned",
                  "missing_cost",
                  "missing_currency",
                  "excluded_date",
                  "excluded_status",
                  "invalid_amount",
                  "excluded_lines"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "platform",
              "view",
              "observed_at",
              "window",
              "documents",
              "coverage",
              "summary"
            ],
            "additionalProperties": false
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "connection_id",
          "data",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "CommerceHistoryStart": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        },
        "required": [
          "org_id",
          "connection_id",
          "policy_version",
          "idempotency_key"
        ],
        "additionalProperties": false
      },
      "CommerceHistoryAssessment": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-history-assessment-v1"
          },
          "status": {
            "type": "string",
            "const": "completed"
          },
          "mode": {
            "type": "string",
            "const": "historical_only"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "assessment_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "assessed_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "window": {
            "type": "object",
            "properties": {
              "days": {
                "type": "number",
                "const": 90
              },
              "start_date": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "end_date_exclusive": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "date_field": {
                "type": "string",
                "const": "postingDate"
              },
              "anchor": {
                "type": "string",
                "const": "server_utc_date"
              }
            },
            "required": [
              "days",
              "start_date",
              "end_date_exclusive",
              "date_field",
              "anchor"
            ],
            "additionalProperties": false
          },
          "policy": {
            "type": "object",
            "properties": {
              "bundle_id": {
                "type": "string",
                "format": "uuid"
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "policy_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "floor_percent": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "comparison": {
                "type": "string",
                "const": "merchandise_margin_against_selected_floor"
              },
              "full_policy_evaluated": {
                "type": "boolean",
                "const": false
              }
            },
            "required": [
              "bundle_id",
              "version",
              "policy_digest",
              "floor_percent",
              "comparison",
              "full_policy_evaluated"
            ],
            "additionalProperties": false
          },
          "source": {
            "type": "string",
            "const": "business-central"
          },
          "cost_scope": {
            "type": "string",
            "const": "merchandise_margin"
          },
          "summary": {
            "type": "object",
            "properties": {
              "documents_scanned": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "documents_assessed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "within_floor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "below_floor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "not_assessed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "missing_cost": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "missing_currency": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              }
            },
            "required": [
              "documents_scanned",
              "documents_assessed",
              "within_floor",
              "below_floor",
              "not_assessed",
              "missing_cost",
              "missing_currency"
            ],
            "additionalProperties": false
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "record_id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "transaction_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "date_precision": {
                  "type": "string",
                  "const": "day"
                },
                "currency": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "finding": {
                  "type": "string",
                  "enum": [
                    "within_floor",
                    "below_floor",
                    "not_assessed"
                  ]
                },
                "reason_codes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "MARGIN_WITHIN_FLOOR",
                      "MARGIN_BELOW_FLOOR",
                      "HISTORICAL_COST_UNAVAILABLE",
                      "CURRENCY_UNAVAILABLE",
                      "COST_CURRENCY_MISMATCH",
                      "AMOUNT_UNAVAILABLE",
                      "LINES_INCOMPLETE",
                      "DATE_OUTSIDE_WINDOW",
                      "DUPLICATE_RECORD",
                      "MARGIN_UNAVAILABLE"
                    ]
                  },
                  "minItems": 1,
                  "maxItems": 8
                },
                "net_margin_percent": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "proof_ref": {
                  "type": "null"
                }
              },
              "required": [
                "record_id",
                "transaction_date",
                "date_precision",
                "currency",
                "finding",
                "reason_codes",
                "net_margin_percent",
                "proof_ref"
              ],
              "additionalProperties": false
            },
            "maxItems": 100
          },
          "coverage": {
            "type": "object",
            "properties": {
              "record_limit": {
                "type": "number",
                "const": 100
              },
              "complete": {
                "type": "boolean"
              },
              "truncated": {
                "type": "boolean"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "historical_cost_unavailable",
                    "document_limit",
                    "line_limit",
                    "page_limit",
                    "duplicate_document",
                    "duplicate_line",
                    "date_excluded",
                    "status_excluded",
                    "currency_unavailable",
                    "amount_unavailable",
                    "response_limit"
                  ]
                },
                "maxItems": 12
              }
            },
            "required": [
              "record_limit",
              "complete",
              "truncated",
              "reasons"
            ],
            "additionalProperties": false
          },
          "proof_ref": {
            "type": "null"
          },
          "evidence_verification": {
            "type": "string",
            "const": "unsigned"
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          },
          "no_downstream_action_executed": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "version",
          "status",
          "mode",
          "org_id",
          "assessment_id",
          "connection_id",
          "connection_revision",
          "assessed_at",
          "observed_at",
          "window",
          "policy",
          "source",
          "cost_scope",
          "summary",
          "findings",
          "coverage",
          "proof_ref",
          "evidence_verification",
          "execution_available",
          "no_downstream_action_executed"
        ],
        "additionalProperties": false
      },
      "CommerceDataOrgQuery": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "org_id"
        ],
        "additionalProperties": false
      },
      "CommerceConnectionCreate": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "display_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "environment_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
          },
          "company_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_secret": {
            "type": "string",
            "pattern": "^[!-~]{16,512}$",
            "writeOnly": true
          }
        },
        "required": [
          "org_id",
          "display_name",
          "environment_name",
          "company_id",
          "client_id",
          "client_secret"
        ],
        "additionalProperties": false
      },
      "CommerceConnectionRevision": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 2147483646
          }
        },
        "required": [
          "org_id",
          "expected_revision"
        ],
        "additionalProperties": false
      },
      "CommerceConnectionCredentials": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 2147483646
          },
          "client_secret": {
            "type": "string",
            "pattern": "^[!-~]{16,512}$",
            "writeOnly": true
          }
        },
        "required": [
          "org_id",
          "expected_revision",
          "client_secret"
        ],
        "additionalProperties": false
      },
      "CommerceConnectionResponse": {
        "type": "object",
        "properties": {
          "connection": {
            "type": "object",
            "properties": {
              "connection_id": {
                "type": "string",
                "format": "uuid"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "display_name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "environment_name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "company_id": {
                "type": "string",
                "format": "uuid"
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 2147483647
              },
              "status": {
                "type": "string",
                "enum": [
                  "PENDING",
                  "ACTIVE",
                  "DISCONNECTED"
                ]
              },
              "verified_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "connection_id",
              "org_id",
              "display_name",
              "environment_name",
              "company_id",
              "revision",
              "status",
              "verified_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "connection"
        ],
        "additionalProperties": false
      },
      "CommerceConnectionsResponse": {
        "type": "object",
        "properties": {
          "connections": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "connection_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "org_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "display_name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "environment_name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "company_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "revision": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 2147483647
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "ACTIVE",
                    "DISCONNECTED"
                  ]
                },
                "verified_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "connection_id",
                "org_id",
                "display_name",
                "environment_name",
                "company_id",
                "revision",
                "status",
                "verified_at"
              ],
              "additionalProperties": false
            },
            "maxItems": 20
          }
        },
        "required": [
          "connections"
        ],
        "additionalProperties": false
      },
      "CommerceConnectionDisconnected": {
        "type": "object",
        "properties": {
          "disconnected": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "disconnected"
        ],
        "additionalProperties": false
      },
      "CommerceNativePolicy": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-native-policy-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy": {
            "type": "object",
            "properties": {
              "bundle_id": {
                "type": "string",
                "format": "uuid"
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "policy_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              }
            },
            "required": [
              "bundle_id",
              "version",
              "policy_digest"
            ],
            "additionalProperties": false
          },
          "snapshot": {
            "type": "object",
            "properties": {
              "policyVersion": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "issuedAt": {
                "type": "string",
                "format": "date-time"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              },
              "failClosed": {
                "type": "boolean",
                "const": true
              },
              "degradationMode": {
                "type": "string",
                "const": "fail_closed"
              },
              "margin": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "const": "net_margin_floor"
                  },
                  "enabled": {
                    "type": "boolean",
                    "const": true
                  },
                  "floorPercent": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  }
                },
                "required": [
                  "key",
                  "enabled",
                  "floorPercent"
                ],
                "additionalProperties": false
              },
              "inventory": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "const": "inventory_floor"
                  },
                  "enabled": {
                    "type": "boolean",
                    "const": false
                  },
                  "minimumAvailable": {
                    "type": "number",
                    "const": 0
                  }
                },
                "required": [
                  "key",
                  "enabled",
                  "minimumAvailable"
                ],
                "additionalProperties": false
              },
              "starterRules": {
                "type": "array",
                "items": {
                  "not": {}
                },
                "maxItems": 0
              },
              "metadataMappings": {
                "type": "array",
                "items": {
                  "not": {}
                },
                "maxItems": 0
              },
              "commerce_binding": {
                "type": "object",
                "properties": {
                  "org_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "purpose": {
                    "type": "string",
                    "const": "business_central_margin_guard"
                  },
                  "policy": {
                    "type": "object",
                    "properties": {
                      "bundle_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "version": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "policy_digest": {
                        "type": "string",
                        "pattern": "^sha256:[a-f0-9]{64}$"
                      }
                    },
                    "required": [
                      "bundle_id",
                      "version",
                      "policy_digest"
                    ],
                    "additionalProperties": false
                  },
                  "evaluated_checks": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 1,
                    "items": [
                      {
                        "type": "string",
                        "const": "margin"
                      }
                    ]
                  },
                  "full_policy_evaluated": {
                    "type": "boolean",
                    "const": false
                  }
                },
                "required": [
                  "org_id",
                  "purpose",
                  "policy",
                  "evaluated_checks",
                  "full_policy_evaluated"
                ],
                "additionalProperties": false
              },
              "signature": {
                "type": "object",
                "properties": {
                  "algorithm": {
                    "type": "string",
                    "const": "Ed25519"
                  },
                  "keyId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "value": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{86}$"
                  }
                },
                "required": [
                  "algorithm",
                  "keyId",
                  "value"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "policyVersion",
              "issuedAt",
              "expiresAt",
              "failClosed",
              "degradationMode",
              "margin",
              "inventory",
              "starterRules",
              "metadataMappings",
              "commerce_binding",
              "signature"
            ],
            "additionalProperties": false
          },
          "snapshot_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "evaluated_checks": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1,
            "items": [
              {
                "type": "string",
                "const": "margin"
              }
            ]
          },
          "full_policy_evaluated": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "policy",
          "snapshot",
          "snapshot_sha256",
          "evaluated_checks",
          "full_policy_evaluated"
        ],
        "additionalProperties": false
      },
      "CommerceNativeSnapshotResponse": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-native-bc-snapshot-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "data": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.business_central.guard.snapshot.v1"
              },
              "connection_id": {
                "type": "string",
                "format": "uuid"
              },
              "document_id": {
                "type": "string",
                "format": "uuid"
              },
              "document_etag": {
                "type": "string",
                "minLength": 3,
                "maxLength": 256,
                "pattern": "^(?:W\\/)?\"[\\x21\\x23-\\x7e]+\"$"
              },
              "configuration_etag": {
                "type": "string",
                "minLength": 3,
                "maxLength": 256,
                "pattern": "^(?:W\\/)?\"[\\x21\\x23-\\x7e]+\"$"
              },
              "source_revision": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160,
                "pattern": "^[\\u0020-\\u007e\\u0080-\\uffff]+$"
              },
              "snapshot_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              },
              "complete": {
                "type": "boolean",
                "const": true
              },
              "cost_provenance": {
                "type": "string",
                "enum": [
                  "native_sales_line_current_estimate",
                  "native_complete_cost_profile"
                ]
              },
              "revenue_provenance": {
                "type": "string",
                "const": "sales_line_amount_excluding_vat_after_discounts"
              },
              "preflight_facts": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "string",
                        "const": "commerce.business_central.native.preflight.v1"
                      },
                      "facts": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "region": {
                            "type": "object",
                            "properties": {
                              "country": {
                                "type": "string",
                                "pattern": "^[A-Z]{2}$"
                              }
                            },
                            "required": [
                              "country"
                            ],
                            "additionalProperties": false
                          },
                          "inventory": {
                            "type": "object",
                            "properties": {
                              "requested_quantity": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "maximum": 1000000000000
                              }
                            },
                            "required": [
                              "requested_quantity"
                            ],
                            "additionalProperties": false
                          },
                          "order_totals": {
                            "type": "object",
                            "properties": {
                              "gross_amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "discount_amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "net_amount_excluding_tax": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              }
                            },
                            "required": [
                              "gross_amount",
                              "discount_amount",
                              "net_amount_excluding_tax"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "currency"
                        ],
                        "additionalProperties": false
                      },
                      "provenance": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string",
                            "const": "Sales Header.Currency Code or General Ledger Setup.LCY Code"
                          },
                          "region": {
                            "type": "string",
                            "const": "Sales Header.Ship-to Country/Region Code mapped through Country/Region.ISO Code"
                          },
                          "inventory.requested_quantity": {
                            "type": "string",
                            "const": "Sales Line.Quantity (Base); one item line only"
                          },
                          "order_totals": {
                            "type": "string",
                            "const": "Sales Line.Line Amount + Line Discount Amount; Line Discount Amount + Inv. Discount Amount; Amount; Prices Including VAT=false"
                          }
                        },
                        "required": [
                          "currency"
                        ],
                        "additionalProperties": false
                      },
                      "unavailable": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "country_mapping",
                            "inventory_requested_quantity_across_items",
                            "gross_discount_allocation",
                            "cost_basis_distinct_sources",
                            "full_landed_cost",
                            "inventory_on_hand_and_reservations",
                            "promotion_chain_and_redemptions",
                            "effective_contract_and_account_type",
                            "lifecycle_mapping",
                            "refund_ledger_and_eligibility"
                          ]
                        },
                        "maxItems": 10
                      }
                    },
                    "required": [
                      "version",
                      "facts",
                      "provenance",
                      "unavailable"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "string",
                        "const": "commerce.business_central.native.preflight.v2"
                      },
                      "facts": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "region": {
                            "type": "object",
                            "properties": {
                              "country": {
                                "type": "string",
                                "pattern": "^[A-Z]{2}$"
                              }
                            },
                            "required": [
                              "country"
                            ],
                            "additionalProperties": false
                          },
                          "order_totals": {
                            "type": "object",
                            "properties": {
                              "gross_amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "discount_amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "net_amount_excluding_tax": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              }
                            },
                            "required": [
                              "gross_amount",
                              "discount_amount",
                              "net_amount_excluding_tax"
                            ],
                            "additionalProperties": false
                          },
                          "cost_basis": {
                            "type": "object",
                            "properties": {
                              "source_cost": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "system_of_record_cost": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              }
                            },
                            "required": [
                              "source_cost",
                              "system_of_record_cost"
                            ],
                            "additionalProperties": false
                          },
                          "inventory": {
                            "type": "object",
                            "properties": {
                              "source_on_hand": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1000000000
                              },
                              "system_on_hand": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1000000000
                              },
                              "reserved_quantity": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1000000000
                              },
                              "requested_quantity": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1000000000,
                                "exclusiveMinimum": 0
                              }
                            },
                            "required": [
                              "source_on_hand",
                              "system_on_hand",
                              "reserved_quantity",
                              "requested_quantity"
                            ],
                            "additionalProperties": false
                          },
                          "discounts": {
                            "type": "object",
                            "properties": {
                              "count": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 2
                              },
                              "sources": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "sales_line_discount",
                                    "sales_invoice_discount"
                                  ]
                                },
                                "maxItems": 2
                              }
                            },
                            "required": [
                              "count",
                              "sources"
                            ],
                            "additionalProperties": false
                          },
                          "contract": {
                            "type": "object",
                            "properties": {
                              "account_type": {
                                "type": "string",
                                "const": "b2b"
                              },
                              "contract_price": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              }
                            },
                            "required": [
                              "account_type",
                              "contract_price"
                            ],
                            "additionalProperties": false
                          },
                          "promotion": {
                            "type": "object",
                            "properties": {
                              "discount_codes": {
                                "type": "array",
                                "minItems": 0,
                                "maxItems": 0,
                                "items": []
                              }
                            },
                            "required": [
                              "discount_codes"
                            ],
                            "additionalProperties": false
                          },
                          "lifecycle": {
                            "type": "object",
                            "properties": {
                              "current_state": {
                                "type": "string",
                                "const": "created"
                              }
                            },
                            "required": [
                              "current_state"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "currency",
                          "region",
                          "order_totals",
                          "cost_basis",
                          "inventory",
                          "discounts",
                          "contract",
                          "promotion",
                          "lifecycle"
                        ],
                        "additionalProperties": false
                      },
                      "provenance": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string",
                            "const": "Sales Header.Currency Code or General Ledger Setup.LCY Code"
                          },
                          "region": {
                            "type": "string",
                            "const": "Sales Header.Ship-to Country/Region Code mapped through Country/Region.ISO Code"
                          },
                          "order_totals": {
                            "type": "string",
                            "const": "Sales Line.Line Amount + Line Discount Amount; Line Discount Amount + Inv. Discount Amount; Amount; Prices Including VAT=false"
                          },
                          "cost_basis": {
                            "type": "string",
                            "const": "sales_line_and_item_unit_cost_plus_explicit_complete_company_cost_profile"
                          },
                          "inventory": {
                            "type": "string",
                            "const": "warehouse_entry_and_item_ledger_entry_with_reservation_pairs"
                          },
                          "discounts": {
                            "type": "string",
                            "const": "observed_native_line_and_invoice_discounts"
                          },
                          "contract": {
                            "type": "string",
                            "const": "explicit_b2b_profile_and_effective_native_customer_price_list"
                          },
                          "promotion": {
                            "type": "string",
                            "const": "complete_native_pricing_sources_without_governed_codes"
                          },
                          "lifecycle": {
                            "type": "string",
                            "const": "open_sales_order_without_posting_or_warehouse_processing"
                          }
                        },
                        "required": [
                          "currency",
                          "region",
                          "order_totals",
                          "cost_basis",
                          "inventory",
                          "discounts",
                          "contract",
                          "promotion",
                          "lifecycle"
                        ],
                        "additionalProperties": false
                      },
                      "unavailable": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 1,
                        "items": [
                          {
                            "type": "string",
                            "const": "refund_ledger_and_eligibility"
                          }
                        ]
                      },
                      "proof": {
                        "type": "object",
                        "properties": {
                          "cohort": {
                            "type": "string",
                            "const": "bc_native_b2b_single_item_lcy_v1"
                          },
                          "profile_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "profile_revision": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]{0,19}$"
                          },
                          "valid_from": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "valid_until": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "source_revisions": {
                            "type": "object",
                            "properties": {
                              "cost": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "inventory": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "pricing": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "lifecycle": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              }
                            },
                            "required": [
                              "cost",
                              "inventory",
                              "pricing",
                              "lifecycle"
                            ],
                            "additionalProperties": false
                          },
                          "complete_additional_costs": {
                            "type": "boolean",
                            "const": true
                          },
                          "complete_native_pricing": {
                            "type": "boolean",
                            "const": true
                          },
                          "consistent_reads": {
                            "type": "boolean",
                            "const": true
                          },
                          "cost_components": {
                            "type": "object",
                            "properties": {
                              "quantity_base": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1000000000,
                                "exclusiveMinimum": 0
                              },
                              "retained_unit_cost": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000,
                                "exclusiveMinimum": 0
                              },
                              "current_item_unit_cost": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000,
                                "exclusiveMinimum": 0
                              },
                              "additional_landed_unit_cost": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "outbound_shipping": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "fixed_fees": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "variable_fee_percent": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 100
                              },
                              "variable_fee_amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "nonrecoverable_tax": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000000
                              },
                              "variable_fee_basis": {
                                "type": "string",
                                "const": "net_revenue_excluding_tax"
                              }
                            },
                            "required": [
                              "quantity_base",
                              "retained_unit_cost",
                              "current_item_unit_cost",
                              "additional_landed_unit_cost",
                              "outbound_shipping",
                              "fixed_fees",
                              "variable_fee_percent",
                              "variable_fee_amount",
                              "nonrecoverable_tax",
                              "variable_fee_basis"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "cohort",
                          "profile_id",
                          "profile_revision",
                          "valid_from",
                          "valid_until",
                          "source_revisions",
                          "complete_additional_costs",
                          "complete_native_pricing",
                          "consistent_reads",
                          "cost_components"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "version",
                      "facts",
                      "provenance",
                      "unavailable",
                      "proof"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "request": {
                "type": "object",
                "properties": {
                  "transaction_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160,
                    "pattern": "^[\\u0020-\\u007e\\u0080-\\uffff]+$"
                  },
                  "erp_type": {
                    "type": "string",
                    "const": "D365_BC"
                  },
                  "tenant_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "agent_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160,
                    "pattern": "^[\\u0020-\\u007e\\u0080-\\uffff]+$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "line_id": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "sku": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 160,
                          "pattern": "^[\\u0020-\\u007e\\u0080-\\uffff]+$"
                        },
                        "quantity": {
                          "type": "number",
                          "exclusiveMinimum": 0,
                          "maximum": 1000000000000
                        },
                        "unit_price": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000000
                        },
                        "cost_base": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000000
                        }
                      },
                      "required": [
                        "line_id",
                        "sku",
                        "quantity",
                        "unit_price",
                        "cost_base"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 200
                  }
                },
                "required": [
                  "transaction_id",
                  "erp_type",
                  "tenant_id",
                  "timestamp",
                  "agent_id",
                  "currency",
                  "lines"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "connection_id",
              "document_id",
              "document_etag",
              "configuration_etag",
              "source_revision",
              "snapshot_sha256",
              "observed_at",
              "complete",
              "cost_provenance",
              "revenue_provenance",
              "preflight_facts",
              "request"
            ],
            "additionalProperties": false
          },
          "policy": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-native-policy-v1"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "policy": {
                "type": "object",
                "properties": {
                  "bundle_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "policy_digest": {
                    "type": "string",
                    "pattern": "^sha256:[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "bundle_id",
                  "version",
                  "policy_digest"
                ],
                "additionalProperties": false
              },
              "snapshot": {
                "type": "object",
                "properties": {
                  "policyVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "issuedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "failClosed": {
                    "type": "boolean",
                    "const": true
                  },
                  "degradationMode": {
                    "type": "string",
                    "const": "fail_closed"
                  },
                  "margin": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string",
                        "const": "net_margin_floor"
                      },
                      "enabled": {
                        "type": "boolean",
                        "const": true
                      },
                      "floorPercent": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100
                      }
                    },
                    "required": [
                      "key",
                      "enabled",
                      "floorPercent"
                    ],
                    "additionalProperties": false
                  },
                  "inventory": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string",
                        "const": "inventory_floor"
                      },
                      "enabled": {
                        "type": "boolean",
                        "const": false
                      },
                      "minimumAvailable": {
                        "type": "number",
                        "const": 0
                      }
                    },
                    "required": [
                      "key",
                      "enabled",
                      "minimumAvailable"
                    ],
                    "additionalProperties": false
                  },
                  "starterRules": {
                    "type": "array",
                    "items": {
                      "not": {}
                    },
                    "maxItems": 0
                  },
                  "metadataMappings": {
                    "type": "array",
                    "items": {
                      "not": {}
                    },
                    "maxItems": 0
                  },
                  "commerce_binding": {
                    "type": "object",
                    "properties": {
                      "org_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "purpose": {
                        "type": "string",
                        "const": "business_central_margin_guard"
                      },
                      "policy": {
                        "type": "object",
                        "properties": {
                          "bundle_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "version": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "policy_digest": {
                            "type": "string",
                            "pattern": "^sha256:[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "bundle_id",
                          "version",
                          "policy_digest"
                        ],
                        "additionalProperties": false
                      },
                      "evaluated_checks": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 1,
                        "items": [
                          {
                            "type": "string",
                            "const": "margin"
                          }
                        ]
                      },
                      "full_policy_evaluated": {
                        "type": "boolean",
                        "const": false
                      }
                    },
                    "required": [
                      "org_id",
                      "purpose",
                      "policy",
                      "evaluated_checks",
                      "full_policy_evaluated"
                    ],
                    "additionalProperties": false
                  },
                  "signature": {
                    "type": "object",
                    "properties": {
                      "algorithm": {
                        "type": "string",
                        "const": "Ed25519"
                      },
                      "keyId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "value": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{86}$"
                      }
                    },
                    "required": [
                      "algorithm",
                      "keyId",
                      "value"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "policyVersion",
                  "issuedAt",
                  "expiresAt",
                  "failClosed",
                  "degradationMode",
                  "margin",
                  "inventory",
                  "starterRules",
                  "metadataMappings",
                  "commerce_binding",
                  "signature"
                ],
                "additionalProperties": false
              },
              "snapshot_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "evaluated_checks": {
                "type": "array",
                "minItems": 1,
                "maxItems": 1,
                "items": [
                  {
                    "type": "string",
                    "const": "margin"
                  }
                ]
              },
              "full_policy_evaluated": {
                "type": "boolean",
                "const": false
              }
            },
            "required": [
              "version",
              "org_id",
              "policy",
              "snapshot",
              "snapshot_sha256",
              "evaluated_checks",
              "full_policy_evaluated"
            ],
            "additionalProperties": false
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "connection_id",
          "connection_revision",
          "data",
          "policy",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "CommerceNativeSafetyResponse": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-native-bc-safety-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.business_central.guard.status.v1"
              },
              "connection_id": {
                "type": "string",
                "format": "uuid"
              },
              "settings_id": {
                "type": "string",
                "format": "uuid"
              },
              "etag": {
                "type": "string",
                "minLength": 3,
                "maxLength": 256,
                "pattern": "^(?:W\\/)?\"[\\x21\\x23-\\x7e]+\"$"
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              },
              "enabled": {
                "type": "boolean"
              },
              "fallback_mode": {
                "type": "string",
                "enum": [
                  "FAIL_OPEN",
                  "FAIL_CLOSED"
                ]
              },
              "default_fallback_mode": {
                "type": "string",
                "const": "FAIL_OPEN"
              },
              "configured": {
                "type": "boolean"
              },
              "can_configure": {
                "type": "boolean"
              },
              "preflight_readiness": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "bc_native_preflight_readiness_v1"
                  },
                  "profile_configured": {
                    "type": "boolean"
                  },
                  "missing": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "evidence_profile",
                        "profile_disabled",
                        "profile_validity",
                        "cost_profile",
                        "pricing_authority",
                        "customer_classification",
                        "customer_binding",
                        "item_binding",
                        "location_binding",
                        "effective_price_list",
                        "native_read_permission"
                      ]
                    },
                    "maxItems": 11
                  },
                  "document_evidence_required": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "version",
                  "profile_configured",
                  "missing",
                  "document_evidence_required"
                ],
                "additionalProperties": false
              },
              "consecutive_failures": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "circuit_open_until": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "last_configuration_operation_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "timeout_ms": {
                "type": "number",
                "const": 150
              },
              "intercepts": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": [
                  {
                    "type": "string",
                    "const": "sales_release"
                  },
                  {
                    "type": "string",
                    "const": "sales_post"
                  }
                ]
              },
              "outage_scope": {
                "type": "string",
                "const": "fail_open_availability_only"
              }
            },
            "required": [
              "version",
              "connection_id",
              "settings_id",
              "etag",
              "observed_at",
              "enabled",
              "fallback_mode",
              "default_fallback_mode",
              "configured",
              "can_configure",
              "consecutive_failures",
              "circuit_open_until",
              "last_configuration_operation_id",
              "timeout_ms",
              "intercepts",
              "outage_scope"
            ],
            "additionalProperties": false
          },
          "outages": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.business_central.guard.outages.v1"
              },
              "connection_id": {
                "type": "string",
                "format": "uuid"
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              },
              "scope": {
                "type": "string",
                "const": "fail_open_availability_only"
              },
              "records": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "failure_type": {
                      "type": "string",
                      "enum": [
                        "HTTP_5XX",
                        "CIRCUIT_OPEN",
                        "TRANSPORT_FAILURE"
                      ]
                    },
                    "attempts": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "processed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "created_at",
                    "failure_type",
                    "attempts",
                    "processed"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 50
              },
              "coverage": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "number",
                    "const": 50
                  },
                  "complete": {
                    "type": "boolean"
                  },
                  "truncated": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "limit",
                  "complete",
                  "truncated"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "connection_id",
              "observed_at",
              "scope",
              "records",
              "coverage"
            ],
            "additionalProperties": false
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "connection_id",
          "connection_revision",
          "status",
          "outages",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "CommerceNativeFallbackRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "settings_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "expected_etag": {
            "type": "string",
            "minLength": 3,
            "maxLength": 256,
            "pattern": "^(?:W\\/)?\"[\\x21\\x23-\\x7e]+\"$"
          },
          "expected_fallback_mode": {
            "type": "string",
            "enum": [
              "FAIL_OPEN",
              "FAIL_CLOSED"
            ]
          },
          "fallback_mode": {
            "type": "string",
            "enum": [
              "FAIL_OPEN",
              "FAIL_CLOSED"
            ]
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[A-Za-z0-9._:-]+$"
          },
          "confirmation": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "org_id",
          "settings_id",
          "expected_connection_revision",
          "expected_etag",
          "expected_fallback_mode",
          "fallback_mode",
          "idempotency_key",
          "confirmation"
        ],
        "additionalProperties": false
      },
      "CommerceNativeFallbackResponse": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-native-bc-configuration-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "outcome": {
            "type": "string",
            "const": "applied"
          },
          "before": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.business_central.guard.status.v1"
              },
              "connection_id": {
                "type": "string",
                "format": "uuid"
              },
              "settings_id": {
                "type": "string",
                "format": "uuid"
              },
              "etag": {
                "type": "string",
                "minLength": 3,
                "maxLength": 256,
                "pattern": "^(?:W\\/)?\"[\\x21\\x23-\\x7e]+\"$"
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              },
              "enabled": {
                "type": "boolean"
              },
              "fallback_mode": {
                "type": "string",
                "enum": [
                  "FAIL_OPEN",
                  "FAIL_CLOSED"
                ]
              },
              "default_fallback_mode": {
                "type": "string",
                "const": "FAIL_OPEN"
              },
              "configured": {
                "type": "boolean"
              },
              "can_configure": {
                "type": "boolean"
              },
              "preflight_readiness": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "bc_native_preflight_readiness_v1"
                  },
                  "profile_configured": {
                    "type": "boolean"
                  },
                  "missing": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "evidence_profile",
                        "profile_disabled",
                        "profile_validity",
                        "cost_profile",
                        "pricing_authority",
                        "customer_classification",
                        "customer_binding",
                        "item_binding",
                        "location_binding",
                        "effective_price_list",
                        "native_read_permission"
                      ]
                    },
                    "maxItems": 11
                  },
                  "document_evidence_required": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "version",
                  "profile_configured",
                  "missing",
                  "document_evidence_required"
                ],
                "additionalProperties": false
              },
              "consecutive_failures": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "circuit_open_until": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "last_configuration_operation_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "timeout_ms": {
                "type": "number",
                "const": 150
              },
              "intercepts": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": [
                  {
                    "type": "string",
                    "const": "sales_release"
                  },
                  {
                    "type": "string",
                    "const": "sales_post"
                  }
                ]
              },
              "outage_scope": {
                "type": "string",
                "const": "fail_open_availability_only"
              }
            },
            "required": [
              "version",
              "connection_id",
              "settings_id",
              "etag",
              "observed_at",
              "enabled",
              "fallback_mode",
              "default_fallback_mode",
              "configured",
              "can_configure",
              "consecutive_failures",
              "circuit_open_until",
              "last_configuration_operation_id",
              "timeout_ms",
              "intercepts",
              "outage_scope"
            ],
            "additionalProperties": false
          },
          "after": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.business_central.guard.status.v1"
              },
              "connection_id": {
                "type": "string",
                "format": "uuid"
              },
              "settings_id": {
                "type": "string",
                "format": "uuid"
              },
              "etag": {
                "type": "string",
                "minLength": 3,
                "maxLength": 256,
                "pattern": "^(?:W\\/)?\"[\\x21\\x23-\\x7e]+\"$"
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              },
              "enabled": {
                "type": "boolean"
              },
              "fallback_mode": {
                "type": "string",
                "enum": [
                  "FAIL_OPEN",
                  "FAIL_CLOSED"
                ]
              },
              "default_fallback_mode": {
                "type": "string",
                "const": "FAIL_OPEN"
              },
              "configured": {
                "type": "boolean"
              },
              "can_configure": {
                "type": "boolean"
              },
              "preflight_readiness": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "bc_native_preflight_readiness_v1"
                  },
                  "profile_configured": {
                    "type": "boolean"
                  },
                  "missing": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "evidence_profile",
                        "profile_disabled",
                        "profile_validity",
                        "cost_profile",
                        "pricing_authority",
                        "customer_classification",
                        "customer_binding",
                        "item_binding",
                        "location_binding",
                        "effective_price_list",
                        "native_read_permission"
                      ]
                    },
                    "maxItems": 11
                  },
                  "document_evidence_required": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "version",
                  "profile_configured",
                  "missing",
                  "document_evidence_required"
                ],
                "additionalProperties": false
              },
              "consecutive_failures": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "circuit_open_until": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "last_configuration_operation_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "timeout_ms": {
                "type": "number",
                "const": 150
              },
              "intercepts": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": [
                  {
                    "type": "string",
                    "const": "sales_release"
                  },
                  {
                    "type": "string",
                    "const": "sales_post"
                  }
                ]
              },
              "outage_scope": {
                "type": "string",
                "const": "fail_open_availability_only"
              }
            },
            "required": [
              "version",
              "connection_id",
              "settings_id",
              "etag",
              "observed_at",
              "enabled",
              "fallback_mode",
              "default_fallback_mode",
              "configured",
              "can_configure",
              "consecutive_failures",
              "circuit_open_until",
              "last_configuration_operation_id",
              "timeout_ms",
              "intercepts",
              "outage_scope"
            ],
            "additionalProperties": false
          },
          "financial_action_executed": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "connection_id",
          "connection_revision",
          "operation_id",
          "outcome",
          "before",
          "after",
          "financial_action_executed"
        ],
        "additionalProperties": false
      },
      "CommerceNativePreflightRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "document_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "policy_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "policy_digest": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "snapshot_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[A-Za-z0-9._:-]+$"
          },
          "confirmation": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "org_id",
          "document_id",
          "connection_revision",
          "policy_version",
          "policy_digest",
          "snapshot_sha256",
          "idempotency_key",
          "confirmation"
        ],
        "additionalProperties": false
      },
      "CommerceNativePreflightResponse": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-native-bc-preflight-v1"
          },
          "input_version": {
            "type": "string",
            "const": "commerce-preflight-partial-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "document_id": {
            "type": "string",
            "format": "uuid"
          },
          "snapshot_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "policy": {
            "type": "object",
            "properties": {
              "bundle_id": {
                "type": "string",
                "format": "uuid"
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "policy_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              }
            },
            "required": [
              "bundle_id",
              "version",
              "policy_digest"
            ],
            "additionalProperties": false
          },
          "mode": {
            "type": "string",
            "const": "SHADOW"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "APPROVE",
              "REJECT",
              "ESCALATE",
              "REVIEW"
            ]
          },
          "verdict": {
            "type": "string",
            "enum": [
              "PROCEED",
              "HOLD",
              "BLOCK",
              "ESCALATE"
            ]
          },
          "preflight": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-preflight-v2"
              },
              "action_type": {
                "type": "string",
                "enum": [
                  "PRICE_CHANGE",
                  "INVENTORY_MUTATION",
                  "ORDER_ACCEPTANCE",
                  "FULFILLMENT_ACTION",
                  "PROMOTION_CHANGE",
                  "REFUND_REQUEST",
                  "RETURN_AUTHORIZATION",
                  "PAYMENT_RELEASE",
                  "VENDOR_BANK_CHANGE",
                  "EARLY_PAYMENT_DISCOUNT",
                  "CREDIT_HOLD_RELEASE"
                ]
              },
              "action_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "facts_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "policy_version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180
              },
              "evaluated_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "disposition": {
                "type": "string",
                "enum": [
                  "PROCEED",
                  "HOLD",
                  "BLOCK"
                ]
              },
              "execution_available": {
                "type": "boolean",
                "const": false
              },
              "checks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "enum": [
                        "P01",
                        "P02",
                        "P03",
                        "P04",
                        "P05",
                        "P06",
                        "P07",
                        "P08",
                        "P09",
                        "P10",
                        "P11",
                        "P12",
                        "P13",
                        "P14",
                        "P15",
                        "P16"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "evaluated",
                        "not_applicable",
                        "disabled",
                        "missing_facts",
                        "unsupported"
                      ]
                    },
                    "verdict": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PROCEED",
                            "HOLD",
                            "BLOCK"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reason_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                      },
                      "minItems": 1,
                      "maxItems": 20
                    },
                    "missing_facts": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 180
                      },
                      "maxItems": 30
                    },
                    "measurements": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "verdict",
                    "reason_codes",
                    "missing_facts"
                  ],
                  "additionalProperties": false
                },
                "minItems": 16,
                "maxItems": 16
              }
            },
            "required": [
              "version",
              "action_type",
              "action_digest",
              "facts_digest",
              "policy_version",
              "idempotency_key",
              "evaluated_at",
              "disposition",
              "execution_available",
              "checks"
            ],
            "additionalProperties": false
          },
          "evaluation_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "idempotent_replay": {
            "type": "boolean"
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "input_version",
          "org_id",
          "connection_id",
          "connection_revision",
          "document_id",
          "snapshot_sha256",
          "policy",
          "mode",
          "outcome",
          "verdict",
          "preflight",
          "evaluation_id",
          "dossier_id",
          "dossier_sha256",
          "idempotent_replay",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "CommerceNativeGrantRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "permissions": {
            "anyOf": [
              {
                "type": "array",
                "minItems": 1,
                "maxItems": 1,
                "items": [
                  {
                    "type": "string",
                    "const": "read"
                  }
                ]
              },
              {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": [
                  {
                    "type": "string",
                    "const": "read"
                  },
                  {
                    "type": "string",
                    "const": "configure"
                  }
                ]
              }
            ]
          },
          "confirmation": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "org_id",
          "expected_revision",
          "permissions",
          "confirmation"
        ],
        "additionalProperties": false
      },
      "CommerceApprovalPrepare": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        "required": [
          "org_id",
          "dossier_id",
          "policy_version"
        ],
        "additionalProperties": false
      },
      "CommerceApprovalEvidence": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-approval-evidence-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "evaluation_id": {
            "type": "string",
            "format": "uuid"
          },
          "action_type": {
            "type": "string",
            "enum": [
              "ORDER_ACCEPTANCE",
              "REFUND_REQUEST"
            ]
          },
          "action_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "platform": {
            "type": "string",
            "enum": [
              "business-central",
              "walmart-marketplace",
              "adobe-commerce"
            ]
          },
          "order_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "amount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "policy": {
            "type": "object",
            "properties": {
              "bundle_id": {
                "type": "string",
                "format": "uuid"
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "policy_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              }
            },
            "required": [
              "bundle_id",
              "version",
              "policy_digest"
            ],
            "additionalProperties": false
          },
          "mode": {
            "type": "string",
            "const": "SHADOW"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "APPROVE",
              "ESCALATE",
              "REJECT",
              "REVIEW"
            ]
          },
          "preflight": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-preflight-v2"
              },
              "action_type": {
                "type": "string",
                "enum": [
                  "PRICE_CHANGE",
                  "INVENTORY_MUTATION",
                  "ORDER_ACCEPTANCE",
                  "FULFILLMENT_ACTION",
                  "PROMOTION_CHANGE",
                  "REFUND_REQUEST",
                  "RETURN_AUTHORIZATION",
                  "PAYMENT_RELEASE",
                  "VENDOR_BANK_CHANGE",
                  "EARLY_PAYMENT_DISCOUNT",
                  "CREDIT_HOLD_RELEASE"
                ]
              },
              "action_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "facts_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "policy_version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180
              },
              "evaluated_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "disposition": {
                "type": "string",
                "enum": [
                  "PROCEED",
                  "HOLD",
                  "BLOCK"
                ]
              },
              "execution_available": {
                "type": "boolean",
                "const": false
              },
              "checks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "enum": [
                        "P01",
                        "P02",
                        "P03",
                        "P04",
                        "P05",
                        "P06",
                        "P07",
                        "P08",
                        "P09",
                        "P10",
                        "P11",
                        "P12",
                        "P13",
                        "P14",
                        "P15",
                        "P16"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "evaluated",
                        "not_applicable",
                        "disabled",
                        "missing_facts",
                        "unsupported"
                      ]
                    },
                    "verdict": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PROCEED",
                            "HOLD",
                            "BLOCK"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reason_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                      },
                      "minItems": 1,
                      "maxItems": 20
                    },
                    "missing_facts": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 180
                      },
                      "maxItems": 30
                    },
                    "measurements": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "verdict",
                    "reason_codes",
                    "missing_facts"
                  ],
                  "additionalProperties": false
                },
                "minItems": 16,
                "maxItems": 16
              }
            },
            "required": [
              "version",
              "action_type",
              "action_digest",
              "facts_digest",
              "policy_version",
              "idempotency_key",
              "evaluated_at",
              "disposition",
              "execution_available",
              "checks"
            ],
            "additionalProperties": false
          },
          "source_evidence": {
            "type": "object",
            "properties": {
              "provenance": {
                "type": "string",
                "enum": [
                  "supplied_evidence",
                  "native_snapshot"
                ]
              },
              "connection_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "revision": {
                "anyOf": [
                  {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "snapshot_sha256": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "provenance",
              "connection_id",
              "revision",
              "snapshot_sha256"
            ],
            "additionalProperties": false
          },
          "review": {
            "type": "object",
            "properties": {
              "summary": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              },
              "facts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "enum": [
                        "resource_id",
                        "amount",
                        "currency",
                        "requested_quantity",
                        "gross_amount",
                        "discount_amount",
                        "estimated_cost",
                        "remaining_refundable",
                        "lifecycle_state"
                      ]
                    },
                    "value": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 200
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "key",
                    "value"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 9
              }
            },
            "required": [
              "summary",
              "facts"
            ],
            "additionalProperties": false
          },
          "verification": {
            "type": "object",
            "properties": {
              "signature_verified": {
                "type": "boolean",
                "const": true
              },
              "inputs_commitment_verified": {
                "type": "boolean",
                "const": true
              },
              "policy_current": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "signature_verified",
              "inputs_commitment_verified",
              "policy_current"
            ],
            "additionalProperties": false
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "dossier_id",
          "dossier_sha256",
          "evaluation_id",
          "action_type",
          "action_sha256",
          "platform",
          "order_id",
          "amount",
          "currency",
          "policy",
          "mode",
          "outcome",
          "preflight",
          "source_evidence",
          "review",
          "verification",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "CommerceApprovalRevalidate": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "case": {
            "type": "object",
            "properties": {
              "case_id": {
                "type": "string",
                "format": "uuid"
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "context_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "action_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "dossier_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "case_id",
              "revision",
              "context_sha256",
              "action_sha256",
              "dossier_sha256"
            ],
            "additionalProperties": false
          },
          "expected": {
            "type": "object",
            "properties": {
              "org_id": {
                "type": "string",
                "pattern": "^org_[a-f0-9]{20}$"
              },
              "workspace_id": {
                "type": "string",
                "pattern": "^ten_[a-f0-9]{20}$"
              },
              "entitlement_id": {
                "type": "string",
                "pattern": "^ent_[a-f0-9]{24}$"
              },
              "source_org_id": {
                "type": "string",
                "format": "uuid"
              },
              "subscription_id": {
                "type": "string",
                "format": "uuid"
              },
              "provider_tenant_id": {
                "type": "string",
                "format": "uuid"
              },
              "source_revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "org_id",
              "workspace_id",
              "entitlement_id",
              "source_org_id",
              "subscription_id",
              "provider_tenant_id",
              "source_revision"
            ],
            "additionalProperties": false
          },
          "source": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string",
                "enum": [
                  "business-central",
                  "walmart-marketplace",
                  "adobe-commerce"
                ]
              },
              "connection_id": {
                "type": "string",
                "format": "uuid"
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "platform",
              "connection_id",
              "revision"
            ],
            "additionalProperties": false
          },
          "authority": {}
        },
        "required": [
          "org_id",
          "dossier_id",
          "policy_version",
          "case",
          "expected",
          "source"
        ],
        "additionalProperties": false
      },
      "CommerceApprovalRevalidated": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-human-review-evidence-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "case": {
            "type": "object",
            "properties": {
              "case_id": {
                "type": "string",
                "format": "uuid"
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "context_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "action_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "dossier_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "case_id",
              "revision",
              "context_sha256",
              "action_sha256",
              "dossier_sha256"
            ],
            "additionalProperties": false
          },
          "actor": {
            "type": "object",
            "properties": {
              "user_id": {
                "type": "string",
                "pattern": "^usr_[a-f0-9]{24}$"
              },
              "org_id": {
                "type": "string",
                "pattern": "^org_[a-f0-9]{20}$"
              },
              "workspace_id": {
                "type": "string",
                "pattern": "^ten_[a-f0-9]{20}$"
              },
              "membership_id": {
                "type": "string",
                "pattern": "^mem_[a-f0-9]{24}$"
              },
              "entitlement_id": {
                "type": "string",
                "pattern": "^ent_[a-f0-9]{24}$"
              },
              "role": {
                "type": "string",
                "enum": [
                  "owner",
                  "admin",
                  "developer",
                  "security_analyst",
                  "billing"
                ]
              },
              "product": {
                "type": "string",
                "const": "commerce"
              },
              "environment": {
                "type": "string",
                "const": "production"
              }
            },
            "required": [
              "user_id",
              "org_id",
              "workspace_id",
              "membership_id",
              "entitlement_id",
              "role",
              "product",
              "environment"
            ],
            "additionalProperties": false
          },
          "supported_sources": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "business-central",
                "walmart-marketplace",
                "adobe-commerce"
              ]
            },
            "minItems": 1,
            "maxItems": 3
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string",
                "enum": [
                  "business-central",
                  "walmart-marketplace",
                  "adobe-commerce"
                ]
              },
              "connection_id": {
                "type": "string",
                "format": "uuid"
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "platform",
              "connection_id",
              "revision"
            ],
            "additionalProperties": false
          },
          "evidence": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-approval-evidence-v1"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "dossier_id": {
                "type": "string",
                "format": "uuid"
              },
              "dossier_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "evaluation_id": {
                "type": "string",
                "format": "uuid"
              },
              "action_type": {
                "type": "string",
                "enum": [
                  "ORDER_ACCEPTANCE",
                  "REFUND_REQUEST"
                ]
              },
              "action_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "platform": {
                "type": "string",
                "enum": [
                  "business-central",
                  "walmart-marketplace",
                  "adobe-commerce"
                ]
              },
              "order_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "policy": {
                "type": "object",
                "properties": {
                  "bundle_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "policy_digest": {
                    "type": "string",
                    "pattern": "^sha256:[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "bundle_id",
                  "version",
                  "policy_digest"
                ],
                "additionalProperties": false
              },
              "mode": {
                "type": "string",
                "const": "SHADOW"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "APPROVE",
                  "ESCALATE",
                  "REJECT",
                  "REVIEW"
                ]
              },
              "preflight": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "commerce-preflight-v2"
                  },
                  "action_type": {
                    "type": "string",
                    "enum": [
                      "PRICE_CHANGE",
                      "INVENTORY_MUTATION",
                      "ORDER_ACCEPTANCE",
                      "FULFILLMENT_ACTION",
                      "PROMOTION_CHANGE",
                      "REFUND_REQUEST",
                      "RETURN_AUTHORIZATION",
                      "PAYMENT_RELEASE",
                      "VENDOR_BANK_CHANGE",
                      "EARLY_PAYMENT_DISCOUNT",
                      "CREDIT_HOLD_RELEASE"
                    ]
                  },
                  "action_digest": {
                    "type": "string",
                    "pattern": "^sha256:[a-f0-9]{64}$"
                  },
                  "facts_digest": {
                    "type": "string",
                    "pattern": "^sha256:[a-f0-9]{64}$"
                  },
                  "policy_version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 180
                  },
                  "evaluated_at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "disposition": {
                    "type": "string",
                    "enum": [
                      "PROCEED",
                      "HOLD",
                      "BLOCK"
                    ]
                  },
                  "execution_available": {
                    "type": "boolean",
                    "const": false
                  },
                  "checks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "enum": [
                            "P01",
                            "P02",
                            "P03",
                            "P04",
                            "P05",
                            "P06",
                            "P07",
                            "P08",
                            "P09",
                            "P10",
                            "P11",
                            "P12",
                            "P13",
                            "P14",
                            "P15",
                            "P16"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "evaluated",
                            "not_applicable",
                            "disabled",
                            "missing_facts",
                            "unsupported"
                          ]
                        },
                        "verdict": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "PROCEED",
                                "HOLD",
                                "BLOCK"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "reason_codes": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                          },
                          "minItems": 1,
                          "maxItems": 20
                        },
                        "missing_facts": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 180
                          },
                          "maxItems": 30
                        },
                        "measurements": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "number"
                          }
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "verdict",
                        "reason_codes",
                        "missing_facts"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 16,
                    "maxItems": 16
                  }
                },
                "required": [
                  "version",
                  "action_type",
                  "action_digest",
                  "facts_digest",
                  "policy_version",
                  "idempotency_key",
                  "evaluated_at",
                  "disposition",
                  "execution_available",
                  "checks"
                ],
                "additionalProperties": false
              },
              "source_evidence": {
                "type": "object",
                "properties": {
                  "provenance": {
                    "type": "string",
                    "enum": [
                      "supplied_evidence",
                      "native_snapshot"
                    ]
                  },
                  "connection_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "revision": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "snapshot_sha256": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "provenance",
                  "connection_id",
                  "revision",
                  "snapshot_sha256"
                ],
                "additionalProperties": false
              },
              "review": {
                "type": "object",
                "properties": {
                  "summary": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "facts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "enum": [
                            "resource_id",
                            "amount",
                            "currency",
                            "requested_quantity",
                            "gross_amount",
                            "discount_amount",
                            "estimated_cost",
                            "remaining_refundable",
                            "lifecycle_state"
                          ]
                        },
                        "value": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 200
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "key",
                        "value"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 9
                  }
                },
                "required": [
                  "summary",
                  "facts"
                ],
                "additionalProperties": false
              },
              "verification": {
                "type": "object",
                "properties": {
                  "signature_verified": {
                    "type": "boolean",
                    "const": true
                  },
                  "inputs_commitment_verified": {
                    "type": "boolean",
                    "const": true
                  },
                  "policy_current": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "signature_verified",
                  "inputs_commitment_verified",
                  "policy_current"
                ],
                "additionalProperties": false
              },
              "execution_available": {
                "type": "boolean",
                "const": false
              }
            },
            "required": [
              "version",
              "org_id",
              "dossier_id",
              "dossier_sha256",
              "evaluation_id",
              "action_type",
              "action_sha256",
              "platform",
              "order_id",
              "amount",
              "currency",
              "policy",
              "mode",
              "outcome",
              "preflight",
              "source_evidence",
              "review",
              "verification",
              "execution_available"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "version",
          "org_id",
          "case",
          "actor",
          "supported_sources",
          "expires_at",
          "source",
          "evidence"
        ],
        "additionalProperties": false
      },
      "CommerceMarketplaceHistoryCompare": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "assessment_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "source": {
            "type": "string",
            "enum": [
              "walmart-marketplace",
              "adobe-commerce"
            ]
          },
          "policy": {
            "type": "object",
            "properties": {
              "bundle_id": {
                "type": "string",
                "format": "uuid"
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "policy_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "floor_percent": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "max_concurrent_discounts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 32
              },
              "price_tolerance_percent": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "price_reference": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "recorded_order_original_price"
                  },
                  "max_markdown_percent": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  }
                },
                "required": [
                  "kind",
                  "max_markdown_percent"
                ],
                "additionalProperties": false
              },
              "comparison": {
                "type": "string",
                "const": "observed_historical_commerce_checks"
              },
              "full_policy_evaluated": {
                "type": "boolean",
                "const": false
              }
            },
            "required": [
              "bundle_id",
              "version",
              "policy_digest",
              "floor_percent",
              "max_concurrent_discounts",
              "price_tolerance_percent",
              "comparison",
              "full_policy_evaluated"
            ],
            "additionalProperties": false
          },
          "window": {
            "type": "object",
            "properties": {
              "days": {
                "type": "number",
                "const": 90
              },
              "start_date": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "end_date_exclusive": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "anchor": {
                "type": "string",
                "const": "server_utc_date"
              }
            },
            "required": [
              "days",
              "start_date",
              "end_date_exclusive",
              "anchor"
            ],
            "additionalProperties": false
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "record_id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "transaction_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "date_precision": {
                  "type": "string",
                  "enum": [
                    "day",
                    "instant"
                  ]
                },
                "transaction_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "currency": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "net_amount_excluding_tax": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1000000000000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "cost_basis": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1000000000000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "cost_currency": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "cost_provenance": {
                  "type": "string",
                  "enum": [
                    "historical_document",
                    "unavailable"
                  ]
                },
                "discount_count": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 10000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "discount_provenance": {
                  "type": "string",
                  "enum": [
                    "historical_document",
                    "unavailable"
                  ]
                },
                "expected_net_amount_excluding_tax": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1000000000000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "expected_price_currency": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "expected_price_provenance": {
                  "type": "string",
                  "enum": [
                    "historical_contract",
                    "unavailable"
                  ]
                },
                "original_price_reference": {
                  "type": "object",
                  "properties": {
                    "amount": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1000000000000,
                      "exclusiveMinimum": 0
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "provenance": {
                      "type": "string",
                      "const": "adobe_order_item_base_original_price"
                    }
                  },
                  "required": [
                    "amount",
                    "currency",
                    "provenance"
                  ],
                  "additionalProperties": false
                },
                "lines_complete": {
                  "type": "boolean"
                }
              },
              "required": [
                "record_id",
                "transaction_date",
                "date_precision",
                "transaction_at",
                "currency",
                "net_amount_excluding_tax",
                "cost_basis",
                "cost_currency",
                "cost_provenance",
                "discount_count",
                "discount_provenance",
                "expected_net_amount_excluding_tax",
                "expected_price_currency",
                "expected_price_provenance",
                "lines_complete"
              ],
              "additionalProperties": false
            },
            "maxItems": 100
          },
          "documents_scanned": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "truncated": {
            "type": "boolean"
          },
          "source_complete": {
            "type": "boolean"
          },
          "source_reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "document_limit",
                "line_limit",
                "source_incomplete",
                "historical_cost_unavailable",
                "currency_unavailable",
                "amount_unavailable",
                "discount_evidence_unavailable",
                "price_reference_unavailable",
                "duplicate_document",
                "date_excluded",
                "status_excluded"
              ]
            },
            "maxItems": 11
          }
        },
        "required": [
          "org_id",
          "assessment_id",
          "connection_id",
          "connection_revision",
          "source",
          "policy",
          "window",
          "observed_at",
          "records",
          "documents_scanned",
          "truncated",
          "source_complete",
          "source_reasons"
        ],
        "additionalProperties": false
      },
      "CommerceMarketplaceHistoryAssessment": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-marketplace-history-v1"
          },
          "status": {
            "type": "string",
            "const": "completed"
          },
          "mode": {
            "type": "string",
            "const": "historical_only"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "assessment_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "source": {
            "type": "string",
            "enum": [
              "walmart-marketplace",
              "adobe-commerce"
            ]
          },
          "assessed_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "window": {
            "type": "object",
            "properties": {
              "days": {
                "type": "number",
                "const": 90
              },
              "start_date": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "end_date_exclusive": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "anchor": {
                "type": "string",
                "const": "server_utc_date"
              }
            },
            "required": [
              "days",
              "start_date",
              "end_date_exclusive",
              "anchor"
            ],
            "additionalProperties": false
          },
          "policy": {
            "type": "object",
            "properties": {
              "bundle_id": {
                "type": "string",
                "format": "uuid"
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "policy_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "floor_percent": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "max_concurrent_discounts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 32
              },
              "price_tolerance_percent": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "price_reference": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "recorded_order_original_price"
                  },
                  "max_markdown_percent": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  }
                },
                "required": [
                  "kind",
                  "max_markdown_percent"
                ],
                "additionalProperties": false
              },
              "comparison": {
                "type": "string",
                "const": "observed_historical_commerce_checks"
              },
              "full_policy_evaluated": {
                "type": "boolean",
                "const": false
              }
            },
            "required": [
              "bundle_id",
              "version",
              "policy_digest",
              "floor_percent",
              "max_concurrent_discounts",
              "price_tolerance_percent",
              "comparison",
              "full_policy_evaluated"
            ],
            "additionalProperties": false
          },
          "cost_scope": {
            "type": "string",
            "const": "merchandise_margin"
          },
          "summary": {
            "type": "object",
            "properties": {
              "documents_scanned": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "documents_returned": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "records_with_findings": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "fully_assessed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "partially_or_not_assessed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "undercost": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "below_margin_floor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "discount_stacking": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "price_discrepancy": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "missing_cost": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "missing_currency": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "missing_discounts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "missing_price_reference": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              }
            },
            "required": [
              "documents_scanned",
              "documents_returned",
              "records_with_findings",
              "fully_assessed",
              "partially_or_not_assessed",
              "undercost",
              "below_margin_floor",
              "discount_stacking",
              "price_discrepancy",
              "missing_cost",
              "missing_currency",
              "missing_discounts",
              "missing_price_reference"
            ],
            "additionalProperties": false
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "record_id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "transaction_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "date_precision": {
                  "type": "string",
                  "enum": [
                    "day",
                    "instant"
                  ]
                },
                "currency": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "checks": {
                  "type": "object",
                  "properties": {
                    "undercost": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "string",
                          "enum": [
                            "finding",
                            "within_rule",
                            "not_assessed"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "UNDER_COST",
                            "AT_OR_ABOVE_COST",
                            "MARGIN_BELOW_FLOOR",
                            "MARGIN_WITHIN_FLOOR",
                            "DISCOUNT_STACKING_REVIEW",
                            "DISCOUNT_STACKING_WITHIN_LIMIT",
                            "PRICE_DISCREPANCY",
                            "PRICE_WITHIN_TOLERANCE",
                            "ORIGINAL_PRICE_MARKDOWN_EXCEEDED",
                            "ORIGINAL_PRICE_MARKDOWN_WITHIN_LIMIT",
                            "HISTORICAL_COST_UNAVAILABLE",
                            "CURRENCY_UNAVAILABLE",
                            "COST_CURRENCY_MISMATCH",
                            "AMOUNT_UNAVAILABLE",
                            "LINES_INCOMPLETE",
                            "DATE_OUTSIDE_WINDOW",
                            "DUPLICATE_RECORD",
                            "DISCOUNT_EVIDENCE_UNAVAILABLE",
                            "PRICE_REFERENCE_UNAVAILABLE",
                            "PRICE_CURRENCY_MISMATCH",
                            "COMPARISON_UNAVAILABLE"
                          ]
                        },
                        "observed": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "threshold": {
                          "type": "number",
                          "minimum": 0
                        },
                        "basis": {
                          "type": "string",
                          "const": "recorded_order_original_price"
                        }
                      },
                      "required": [
                        "result",
                        "reason",
                        "observed",
                        "threshold"
                      ],
                      "additionalProperties": false
                    },
                    "margin": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "string",
                          "enum": [
                            "finding",
                            "within_rule",
                            "not_assessed"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "UNDER_COST",
                            "AT_OR_ABOVE_COST",
                            "MARGIN_BELOW_FLOOR",
                            "MARGIN_WITHIN_FLOOR",
                            "DISCOUNT_STACKING_REVIEW",
                            "DISCOUNT_STACKING_WITHIN_LIMIT",
                            "PRICE_DISCREPANCY",
                            "PRICE_WITHIN_TOLERANCE",
                            "ORIGINAL_PRICE_MARKDOWN_EXCEEDED",
                            "ORIGINAL_PRICE_MARKDOWN_WITHIN_LIMIT",
                            "HISTORICAL_COST_UNAVAILABLE",
                            "CURRENCY_UNAVAILABLE",
                            "COST_CURRENCY_MISMATCH",
                            "AMOUNT_UNAVAILABLE",
                            "LINES_INCOMPLETE",
                            "DATE_OUTSIDE_WINDOW",
                            "DUPLICATE_RECORD",
                            "DISCOUNT_EVIDENCE_UNAVAILABLE",
                            "PRICE_REFERENCE_UNAVAILABLE",
                            "PRICE_CURRENCY_MISMATCH",
                            "COMPARISON_UNAVAILABLE"
                          ]
                        },
                        "observed": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "threshold": {
                          "type": "number",
                          "minimum": 0
                        },
                        "basis": {
                          "type": "string",
                          "const": "recorded_order_original_price"
                        }
                      },
                      "required": [
                        "result",
                        "reason",
                        "observed",
                        "threshold"
                      ],
                      "additionalProperties": false
                    },
                    "discount_stacking": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "string",
                          "enum": [
                            "finding",
                            "within_rule",
                            "not_assessed"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "UNDER_COST",
                            "AT_OR_ABOVE_COST",
                            "MARGIN_BELOW_FLOOR",
                            "MARGIN_WITHIN_FLOOR",
                            "DISCOUNT_STACKING_REVIEW",
                            "DISCOUNT_STACKING_WITHIN_LIMIT",
                            "PRICE_DISCREPANCY",
                            "PRICE_WITHIN_TOLERANCE",
                            "ORIGINAL_PRICE_MARKDOWN_EXCEEDED",
                            "ORIGINAL_PRICE_MARKDOWN_WITHIN_LIMIT",
                            "HISTORICAL_COST_UNAVAILABLE",
                            "CURRENCY_UNAVAILABLE",
                            "COST_CURRENCY_MISMATCH",
                            "AMOUNT_UNAVAILABLE",
                            "LINES_INCOMPLETE",
                            "DATE_OUTSIDE_WINDOW",
                            "DUPLICATE_RECORD",
                            "DISCOUNT_EVIDENCE_UNAVAILABLE",
                            "PRICE_REFERENCE_UNAVAILABLE",
                            "PRICE_CURRENCY_MISMATCH",
                            "COMPARISON_UNAVAILABLE"
                          ]
                        },
                        "observed": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "threshold": {
                          "type": "number",
                          "minimum": 0
                        },
                        "basis": {
                          "type": "string",
                          "const": "recorded_order_original_price"
                        }
                      },
                      "required": [
                        "result",
                        "reason",
                        "observed",
                        "threshold"
                      ],
                      "additionalProperties": false
                    },
                    "price_discrepancy": {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "string",
                          "enum": [
                            "finding",
                            "within_rule",
                            "not_assessed"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "UNDER_COST",
                            "AT_OR_ABOVE_COST",
                            "MARGIN_BELOW_FLOOR",
                            "MARGIN_WITHIN_FLOOR",
                            "DISCOUNT_STACKING_REVIEW",
                            "DISCOUNT_STACKING_WITHIN_LIMIT",
                            "PRICE_DISCREPANCY",
                            "PRICE_WITHIN_TOLERANCE",
                            "ORIGINAL_PRICE_MARKDOWN_EXCEEDED",
                            "ORIGINAL_PRICE_MARKDOWN_WITHIN_LIMIT",
                            "HISTORICAL_COST_UNAVAILABLE",
                            "CURRENCY_UNAVAILABLE",
                            "COST_CURRENCY_MISMATCH",
                            "AMOUNT_UNAVAILABLE",
                            "LINES_INCOMPLETE",
                            "DATE_OUTSIDE_WINDOW",
                            "DUPLICATE_RECORD",
                            "DISCOUNT_EVIDENCE_UNAVAILABLE",
                            "PRICE_REFERENCE_UNAVAILABLE",
                            "PRICE_CURRENCY_MISMATCH",
                            "COMPARISON_UNAVAILABLE"
                          ]
                        },
                        "observed": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "threshold": {
                          "type": "number",
                          "minimum": 0
                        },
                        "basis": {
                          "type": "string",
                          "const": "recorded_order_original_price"
                        }
                      },
                      "required": [
                        "result",
                        "reason",
                        "observed",
                        "threshold"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "undercost",
                    "margin",
                    "discount_stacking",
                    "price_discrepancy"
                  ],
                  "additionalProperties": false
                },
                "proof_ref": {
                  "type": "null"
                }
              },
              "required": [
                "record_id",
                "transaction_date",
                "date_precision",
                "currency",
                "checks",
                "proof_ref"
              ],
              "additionalProperties": false
            },
            "maxItems": 100
          },
          "coverage": {
            "type": "object",
            "properties": {
              "record_limit": {
                "type": "number",
                "const": 100
              },
              "complete": {
                "type": "boolean"
              },
              "truncated": {
                "type": "boolean"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "document_limit",
                    "line_limit",
                    "source_incomplete",
                    "historical_cost_unavailable",
                    "currency_unavailable",
                    "amount_unavailable",
                    "discount_evidence_unavailable",
                    "price_reference_unavailable",
                    "duplicate_document",
                    "date_excluded",
                    "status_excluded"
                  ]
                },
                "maxItems": 11
              }
            },
            "required": [
              "record_limit",
              "complete",
              "truncated",
              "reasons"
            ],
            "additionalProperties": false
          },
          "proof_ref": {
            "type": "null"
          },
          "evidence_verification": {
            "type": "string",
            "const": "unsigned"
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          },
          "no_downstream_action_executed": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "version",
          "status",
          "mode",
          "org_id",
          "assessment_id",
          "connection_id",
          "connection_revision",
          "source",
          "assessed_at",
          "observed_at",
          "window",
          "policy",
          "cost_scope",
          "summary",
          "findings",
          "coverage",
          "proof_ref",
          "evidence_verification",
          "execution_available",
          "no_downstream_action_executed"
        ],
        "additionalProperties": false
      },
      "CommerceMarketplaceHistoryPolicy": {
        "type": "object",
        "properties": {
          "bundle_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "policy_digest": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "floor_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "max_concurrent_discounts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "price_tolerance_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "price_reference": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "recorded_order_original_price"
              },
              "max_markdown_percent": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              }
            },
            "required": [
              "kind",
              "max_markdown_percent"
            ],
            "additionalProperties": false
          },
          "comparison": {
            "type": "string",
            "const": "observed_historical_commerce_checks"
          },
          "full_policy_evaluated": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "bundle_id",
          "version",
          "policy_digest",
          "floor_percent",
          "max_concurrent_discounts",
          "price_tolerance_percent",
          "comparison",
          "full_policy_evaluated"
        ],
        "additionalProperties": false
      },
      "CommerceConnectedSourceAuthority": {
        "type": "object",
        "properties": {
          "payload": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "accounts-commerce-source-v3"
              },
              "purpose": {
                "type": "string",
                "const": "commerce_oauth_projection"
              },
              "resource": {
                "type": "string",
                "format": "uri",
                "maxLength": 2048
              },
              "oauth_grant_id": {
                "type": "string",
                "format": "uuid"
              },
              "account_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "source_org_id": {
                "type": "string",
                "format": "uuid"
              },
              "provider": {
                "type": "string",
                "const": "microsoft"
              },
              "subscription_id": {
                "type": "string",
                "format": "uuid"
              },
              "publisher_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
              },
              "offer_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
              },
              "plan_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
              },
              "source_entitlement": {
                "type": "object",
                "properties": {
                  "entitlement_id": {
                    "type": "string",
                    "pattern": "^ent_[a-f0-9]{24}$"
                  },
                  "product": {
                    "type": "string",
                    "pattern": "^commerce_ms_[a-f0-9]{24}$"
                  },
                  "product_plan": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
                  },
                  "revision": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "environment": {
                    "type": "string",
                    "const": "production"
                  },
                  "status": {
                    "type": "string",
                    "const": "active"
                  }
                },
                "required": [
                  "entitlement_id",
                  "product",
                  "product_plan",
                  "revision",
                  "environment",
                  "status"
                ],
                "additionalProperties": false
              },
              "issued_at": {
                "type": "string",
                "format": "date-time"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "provider_tenant_id": {
                "type": "string",
                "format": "uuid"
              },
              "authorization": {
                "type": "object",
                "properties": {
                  "profile_version": {
                    "type": "number",
                    "const": 3
                  },
                  "client_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^[A-Za-z0-9._-]+$"
                  },
                  "scopes": {
                    "type": "array",
                    "minItems": 9,
                    "maxItems": 9,
                    "items": [
                      {
                        "type": "string",
                        "const": "decision:read"
                      },
                      {
                        "type": "string",
                        "const": "decision:run"
                      },
                      {
                        "type": "string",
                        "const": "policy:read"
                      },
                      {
                        "type": "string",
                        "const": "erp:read"
                      },
                      {
                        "type": "string",
                        "const": "history:assess"
                      },
                      {
                        "type": "string",
                        "const": "marketplace:read"
                      },
                      {
                        "type": "string",
                        "const": "erp:validate"
                      },
                      {
                        "type": "string",
                        "const": "approval:request"
                      },
                      {
                        "type": "string",
                        "const": "erp:configure"
                      }
                    ]
                  },
                  "consent_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "consent_text_version": {
                    "type": "string",
                    "const": "commerce-connected-consent-v1"
                  },
                  "consent_sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "consented_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "account_role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "admin",
                      "developer"
                    ]
                  },
                  "supported_sources": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "business-central",
                        "walmart-marketplace",
                        "adobe-commerce"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 3
                  }
                },
                "required": [
                  "profile_version",
                  "client_id",
                  "scopes",
                  "consent_id",
                  "consent_text_version",
                  "consent_sha256",
                  "consented_at",
                  "account_role",
                  "supported_sources"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "purpose",
              "resource",
              "oauth_grant_id",
              "account_sha256",
              "source_org_id",
              "provider",
              "subscription_id",
              "publisher_id",
              "offer_id",
              "plan_id",
              "source_entitlement",
              "issued_at",
              "expires_at",
              "provider_tenant_id",
              "authorization"
            ],
            "additionalProperties": false
          },
          "evidence": {
            "type": "object",
            "properties": {
              "algorithm": {
                "type": "string",
                "const": "Ed25519"
              },
              "key_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._-]{1,128}$"
              },
              "payload_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "signature": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{86}$"
              }
            },
            "required": [
              "algorithm",
              "key_id",
              "payload_sha256",
              "signature"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "payload",
          "evidence"
        ],
        "additionalProperties": false
      },
      "CommerceConnectedAuthority": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-connected-authority-v1"
          },
          "account_user_id": {
            "type": "string",
            "pattern": "^usr_[a-f0-9]{24}$"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "membership_id": {
            "type": "string",
            "pattern": "^mem_[a-f0-9]{24}$"
          },
          "entitlement_id": {
            "type": "string",
            "pattern": "^ent_[a-f0-9]{24}$"
          },
          "account_role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "developer"
            ]
          },
          "provider_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "source_revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "source_plan": {
            "type": "object",
            "properties": {
              "publisher_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
              },
              "offer_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
              },
              "plan_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
              }
            },
            "required": [
              "publisher_id",
              "offer_id",
              "plan_id"
            ],
            "additionalProperties": false
          },
          "supported_sources": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "business-central",
                "walmart-marketplace",
                "adobe-commerce"
              ]
            },
            "minItems": 1,
            "maxItems": 3
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "history_assessment_limit_monthly": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 2147483647
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "version",
          "account_user_id",
          "account_org_id",
          "workspace_id",
          "membership_id",
          "entitlement_id",
          "account_role",
          "provider_tenant_id",
          "subscription_id",
          "source_revision",
          "source_plan",
          "supported_sources",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "CommerceInitialPolicy": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-onboarding-shadow-v1"
          },
          "bundle_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "const": "SHADOW"
          },
          "source": {
            "type": "string",
            "const": "accounts_commerce_onboarding"
          },
          "policy_digest": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          }
        },
        "required": [
          "version",
          "bundle_id",
          "mode",
          "source",
          "policy_digest"
        ],
        "additionalProperties": false
      },
      "CommerceMarketplaceHistoryRules": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-marketplace-history-policy-v1"
          },
          "price_reference": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "recorded_order_original_price"
              },
              "max_markdown_percent": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              }
            },
            "required": [
              "kind",
              "max_markdown_percent"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "version",
          "price_reference"
        ],
        "additionalProperties": false
      },
      "AccountsWorkspaceCredentialIssueRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "label"
        ],
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
          }
        }
      },
      "AccountsWorkspaceCredentialEmptyRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [],
        "properties": {}
      },
      "AccountsWorkspaceCredentialIssueCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "command_id",
          "purpose",
          "account_org_id",
          "account_workspace_id",
          "account_user_id",
          "product",
          "environment",
          "role",
          "issued_at",
          "authorization_expires_at",
          "action",
          "label"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-workspace-credential-v1"
          },
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "purpose": {
            "type": "string",
            "const": "protocol"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "account_user_id": {
            "type": "string",
            "pattern": "^usr_[a-f0-9]{24}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "authorization_expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "action": {
            "type": "string",
            "const": "issue"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
          }
        }
      },
      "AccountsWorkspaceCredentialListCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "command_id",
          "purpose",
          "account_org_id",
          "account_workspace_id",
          "account_user_id",
          "product",
          "environment",
          "role",
          "issued_at",
          "authorization_expires_at",
          "action"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-workspace-credential-v1"
          },
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "purpose": {
            "type": "string",
            "const": "protocol"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "account_user_id": {
            "type": "string",
            "pattern": "^usr_[a-f0-9]{24}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "authorization_expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "action": {
            "type": "string",
            "const": "list"
          }
        }
      },
      "AccountsWorkspaceCredentialRevokeCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "command_id",
          "purpose",
          "account_org_id",
          "account_workspace_id",
          "account_user_id",
          "product",
          "environment",
          "role",
          "issued_at",
          "authorization_expires_at",
          "action",
          "key_id"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-workspace-credential-v1"
          },
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "purpose": {
            "type": "string",
            "const": "protocol"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "account_user_id": {
            "type": "string",
            "pattern": "^usr_[a-f0-9]{24}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "authorization_expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "action": {
            "type": "string",
            "const": "revoke"
          },
          "key_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "AccountsWorkspaceCredentialCommand": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialIssueCommand"
          },
          {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialListCommand"
          },
          {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialRevokeCommand"
          }
        ]
      },
      "AccountsWorkspaceCredentialEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "algorithm",
          "key_id",
          "payload_sha256",
          "signature"
        ],
        "properties": {
          "algorithm": {
            "type": "string",
            "const": "Ed25519"
          },
          "key_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "payload_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "signature": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{86}$"
          }
        }
      },
      "AccountsWorkspaceCredentialCommandEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload",
          "evidence"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialCommand"
          },
          "evidence": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialEvidence"
          }
        }
      },
      "AccountsWorkspaceCredentialCredential": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key_id",
          "label",
          "role",
          "scopes",
          "created_at",
          "expires_at",
          "revoked_at"
        ],
        "properties": {
          "key_id": {
            "type": "string",
            "format": "uuid"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
          },
          "role": {
            "type": "string",
            "const": "MEMBER"
          },
          "scopes": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "prefixItems": [
              {
                "type": "string",
                "const": "decision:read"
              },
              {
                "type": "string",
                "const": "decision:write"
              }
            ],
            "items": false
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
              },
              {
                "type": "null"
              }
            ]
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "AccountsWorkspaceCredentialIssued": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "command_id",
          "account_org_id",
          "account_workspace_id",
          "product",
          "environment",
          "status",
          "credential",
          "raw_key"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-workspace-credential-v1"
          },
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "status": {
            "type": "string",
            "const": "issued"
          },
          "credential": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialCredential"
          },
          "raw_key": {
            "type": "string",
            "minLength": 20,
            "maxLength": 512,
            "pattern": "^[\\u0021-\\u007e]+$"
          }
        }
      },
      "AccountsWorkspaceCredentialAlreadyIssued": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "command_id",
          "account_org_id",
          "account_workspace_id",
          "product",
          "environment",
          "status",
          "credential"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-workspace-credential-v1"
          },
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "status": {
            "type": "string",
            "const": "already_issued"
          },
          "credential": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialCredential"
          }
        }
      },
      "AccountsWorkspaceCredentialListed": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "command_id",
          "account_org_id",
          "account_workspace_id",
          "product",
          "environment",
          "status",
          "credentials",
          "truncated"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-workspace-credential-v1"
          },
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "status": {
            "type": "string",
            "const": "listed"
          },
          "credentials": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/AccountsWorkspaceCredentialCredential"
            }
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "AccountsWorkspaceCredentialRevoked": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "command_id",
          "account_org_id",
          "account_workspace_id",
          "product",
          "environment",
          "status",
          "credential"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-workspace-credential-v1"
          },
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "status": {
            "type": "string",
            "const": "revoked"
          },
          "credential": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialCredential"
          }
        }
      },
      "AccountsWorkspaceCredentialResult": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialIssued"
          },
          {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialAlreadyIssued"
          },
          {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialListed"
          },
          {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialRevoked"
          }
        ]
      },
      "AccountsWorkspaceCredentialError": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "WORKSPACE_CREDENTIAL_INVALID",
              "WORKSPACE_CREDENTIAL_DENIED",
              "WORKSPACE_CREDENTIAL_NOT_FOUND",
              "WORKSPACE_CREDENTIAL_CONFLICT",
              "WORKSPACE_CREDENTIAL_UNAVAILABLE"
            ]
          }
        }
      },
      "AccountsWorkspaceCredentialIssueEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload",
          "evidence"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialIssueCommand"
          },
          "evidence": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialEvidence"
          }
        }
      },
      "AccountsWorkspaceCredentialListEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload",
          "evidence"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialListCommand"
          },
          "evidence": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialEvidence"
          }
        }
      },
      "AccountsWorkspaceCredentialRevokeEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload",
          "evidence"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialRevokeCommand"
          },
          "evidence": {
            "$ref": "#/components/schemas/AccountsWorkspaceCredentialEvidence"
          }
        }
      },
      "CommerceNativeContext": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-native-context-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "workspace_environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "erp_type": {
            "type": "string",
            "const": "D365_BC"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "expected_revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "environment_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
          },
          "company_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "basis": {
            "type": "string",
            "const": "persisted_connection_and_native_grant"
          },
          "provider_read_authority": {
            "type": "string",
            "const": "not_checked"
          },
          "execution_available": {
            "type": "boolean"
          }
        },
        "required": [
          "version",
          "org_id",
          "workspace_environment",
          "erp_type",
          "tenant_id",
          "connection_id",
          "expected_revision",
          "environment_name",
          "company_id",
          "basis",
          "provider_read_authority",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "AccountsNativeEnrollmentConnection": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "connection_id",
          "expected_revision"
        ],
        "properties": {
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "expected_revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          }
        }
      },
      "AccountsNativeEnrollmentRequestedBinding": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "platform",
          "environment_name",
          "company_id",
          "requested_permissions"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "const": "D365_BC"
          },
          "environment_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
          },
          "company_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "requested_permissions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1,
            "prefixItems": [
              {
                "type": "string",
                "const": "read"
              }
            ],
            "items": false
          }
        }
      },
      "AccountsNativeEnrollmentProviderEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "tenant_id",
          "subject_sha256",
          "verified_at",
          "identity_expires_at"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "const": "microsoft_entra"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "subject_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "identity_expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          }
        }
      },
      "AccountsNativeEnrollmentEnrollCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "account_org_id",
          "account_workspace_id",
          "product",
          "workspace_environment",
          "command_id",
          "enrollment_id",
          "purpose",
          "account_user_id",
          "role",
          "issued_at",
          "authorization_expires_at",
          "action",
          "requested_binding",
          "provider_evidence"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-native-enrollment-v1"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "workspace_environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "command_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "enrollment_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "purpose": {
            "type": "string",
            "const": "native_connection_enrollment"
          },
          "account_user_id": {
            "type": "string",
            "pattern": "^usr_[a-f0-9]{24}$"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "authorization_expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "action": {
            "type": "string",
            "const": "enroll"
          },
          "requested_binding": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentRequestedBinding"
          },
          "provider_evidence": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentProviderEvidence"
          },
          "existing_connection": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentConnection"
          }
        }
      },
      "AccountsNativeEnrollmentRevokeCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "account_org_id",
          "account_workspace_id",
          "product",
          "workspace_environment",
          "command_id",
          "enrollment_id",
          "purpose",
          "account_user_id",
          "role",
          "issued_at",
          "authorization_expires_at",
          "action",
          "existing_connection"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-native-enrollment-v1"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "workspace_environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "command_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "enrollment_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "purpose": {
            "type": "string",
            "const": "native_connection_enrollment"
          },
          "account_user_id": {
            "type": "string",
            "pattern": "^usr_[a-f0-9]{24}$"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "authorization_expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "action": {
            "type": "string",
            "const": "revoke"
          },
          "existing_connection": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentConnection"
          }
        }
      },
      "AccountsNativeEnrollmentStatusCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "account_org_id",
          "account_workspace_id",
          "product",
          "workspace_environment",
          "command_id",
          "enrollment_id",
          "purpose",
          "account_user_id",
          "role",
          "issued_at",
          "authorization_expires_at",
          "action"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-native-enrollment-v1"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "workspace_environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "command_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "enrollment_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "purpose": {
            "type": "string",
            "const": "native_connection_enrollment"
          },
          "account_user_id": {
            "type": "string",
            "pattern": "^usr_[a-f0-9]{24}$"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "authorization_expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "action": {
            "type": "string",
            "const": "status"
          }
        }
      },
      "AccountsNativeEnrollmentCommand": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentEnrollCommand"
          },
          {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentRevokeCommand"
          },
          {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentStatusCommand"
          }
        ]
      },
      "AccountsNativeEnrollmentEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "algorithm",
          "key_id",
          "payload_sha256",
          "signature"
        ],
        "properties": {
          "algorithm": {
            "type": "string",
            "const": "Ed25519"
          },
          "key_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "payload_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "signature": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{86}$"
          }
        }
      },
      "AccountsNativeEnrollmentCommandEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload",
          "evidence"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentCommand"
          },
          "evidence": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentEvidence"
          }
        }
      },
      "AccountsNativeEnrollmentEnrolled": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "account_org_id",
          "account_workspace_id",
          "product",
          "workspace_environment",
          "command_id",
          "enrollment_id",
          "connection_id",
          "connection_revision",
          "platform",
          "tenant_id",
          "environment_name",
          "company_id",
          "execution_available",
          "status",
          "read_granted",
          "provider_read_observed_at",
          "guard_enabled",
          "guard_configured"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-native-enrollment-v1"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "workspace_environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "command_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "enrollment_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "connection_revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "platform": {
            "type": "string",
            "const": "D365_BC"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "environment_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
          },
          "company_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          },
          "status": {
            "type": "string",
            "const": "enrolled"
          },
          "read_granted": {
            "type": "boolean",
            "const": true
          },
          "provider_read_observed_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
          },
          "guard_enabled": {
            "type": "boolean"
          },
          "guard_configured": {
            "type": "boolean"
          }
        }
      },
      "AccountsNativeEnrollmentRevoked": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "account_org_id",
          "account_workspace_id",
          "product",
          "workspace_environment",
          "command_id",
          "enrollment_id",
          "connection_id",
          "connection_revision",
          "platform",
          "tenant_id",
          "environment_name",
          "company_id",
          "execution_available",
          "status",
          "read_granted",
          "provider_read_observed_at",
          "guard_enabled",
          "guard_configured"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-native-enrollment-v1"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "workspace_environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "command_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "enrollment_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "connection_revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "platform": {
            "type": "string",
            "const": "D365_BC"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "environment_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
          },
          "company_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          },
          "status": {
            "type": "string",
            "const": "revoked"
          },
          "read_granted": {
            "type": "boolean",
            "const": false
          },
          "provider_read_observed_at": {
            "type": "null"
          },
          "guard_enabled": {
            "type": "null"
          },
          "guard_configured": {
            "type": "null"
          }
        }
      },
      "AccountsNativeEnrollmentResult": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentEnrolled"
          },
          {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentRevoked"
          }
        ]
      },
      "AccountsNativeEnrollmentRecoveryResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "account_org_id",
          "account_workspace_id",
          "product",
          "workspace_environment",
          "command_id",
          "enrollment_id",
          "connection_id",
          "connection_revision",
          "platform",
          "tenant_id",
          "environment_name",
          "company_id",
          "execution_available",
          "status",
          "read_granted",
          "provider_read_observed_at",
          "guard_enabled",
          "guard_configured",
          "enrollment_status"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-native-enrollment-v1"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "product": {
            "type": "string",
            "const": "commerce"
          },
          "workspace_environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "command_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "enrollment_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "connection_revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "platform": {
            "type": "string",
            "const": "D365_BC"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "environment_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
          },
          "company_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          },
          "status": {
            "type": "string",
            "const": "recorded"
          },
          "read_granted": {
            "type": "boolean"
          },
          "provider_read_observed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
              },
              {
                "type": "null"
              }
            ]
          },
          "guard_enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "guard_configured": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "enrollment_status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "revoked"
            ]
          }
        }
      },
      "AccountsNativeEnrollmentResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentResult"
          },
          {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentRecoveryResult"
          }
        ]
      },
      "AccountsNativeEnrollmentError": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "NATIVE_ENROLLMENT_INVALID",
              "NATIVE_ENROLLMENT_DENIED",
              "NATIVE_ENROLLMENT_NOT_FOUND",
              "NATIVE_ENROLLMENT_CONFLICT",
              "NATIVE_ENROLLMENT_UNAVAILABLE"
            ]
          }
        }
      },
      "AccountsNativeEnrollmentEnrollEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload",
          "evidence"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentEnrollCommand"
          },
          "evidence": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentEvidence"
          }
        }
      },
      "AccountsNativeEnrollmentRevokeEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload",
          "evidence"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentRevokeCommand"
          },
          "evidence": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentEvidence"
          }
        }
      },
      "AccountsNativeEnrollmentStatusEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload",
          "evidence"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentStatusCommand"
          },
          "evidence": {
            "$ref": "#/components/schemas/AccountsNativeEnrollmentEvidence"
          }
        }
      },
      "CommercePaymentEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "method",
          "journal_id",
          "journal_revision",
          "batch_id",
          "batch_revision",
          "invoice_entry_id",
          "invoice_revision",
          "invoice_remaining_amount",
          "funding_bank_id",
          "funding_bank_revision",
          "beneficiary_bank_id",
          "beneficiary_bank_revision",
          "source_revisions",
          "snapshot_sha256"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-payment-evidence-v1"
          },
          "method": {
            "type": "string",
            "const": "ledger_cash_same_currency_single_payment_v1"
          },
          "source": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "sandbox",
              "evaluation_company"
            ],
            "properties": {
              "sandbox": {
                "type": "boolean"
              },
              "evaluation_company": {
                "type": "boolean"
              }
            }
          },
          "journal_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "journal_revision": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "maxLength": 19
          },
          "batch_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "batch_revision": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "maxLength": 19
          },
          "invoice_entry_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "invoice_revision": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "maxLength": 19
          },
          "invoice_remaining_amount": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000000000
          },
          "funding_bank_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "funding_bank_revision": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "maxLength": 19
          },
          "beneficiary_bank_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "beneficiary_bank_revision": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "maxLength": 19
          },
          "source_revisions": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "run",
              "invoice",
              "treasury"
            ],
            "properties": {
              "run": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "invoice": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "treasury": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            }
          },
          "snapshot_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "CommercePaymentAuthorization": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "attempt_id",
          "expires_at",
          "source_snapshot_sha256"
        ],
        "properties": {
          "attempt_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "maxLength": 40
          },
          "source_snapshot_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "CommerceErpPaymentGuardRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "transaction_id",
          "erp_type",
          "tenant_id",
          "timestamp",
          "agent_id",
          "mode",
          "payment",
          "facts"
        ],
        "properties": {
          "transaction_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "erp_type": {
            "type": "string",
            "enum": [
              "D365_BC",
              "D365_FSCM"
            ]
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "native_context": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "org_id",
              "workspace_environment",
              "connection_id",
              "expected_revision",
              "environment_name",
              "company_id"
            ],
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-native-context-v1"
              },
              "org_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "workspace_environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "connection_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "expected_revision": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2147483647
              },
              "environment_name": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
              },
              "company_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              }
            }
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "agent_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "mode": {
            "type": "string",
            "enum": [
              "OBSERVE",
              "ENFORCE"
            ]
          },
          "payment": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "payment_id",
              "vendor_id",
              "amount",
              "currency"
            ],
            "properties": {
              "payment_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "vendor_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "invoice_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "due_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "rail": {
                "type": "string",
                "enum": [
                  "ach",
                  "wire",
                  "card",
                  "stablecoin",
                  "other"
                ]
              }
            }
          },
          "facts": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "observed_at"
            ],
            "properties": {
              "observed_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "payment": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "prior_payment_count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  }
                }
              },
              "treasury": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cash_position": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "run_total": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  }
                }
              },
              "beneficiary": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "changed_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "verification": {
                    "type": "string",
                    "enum": [
                      "verified",
                      "unverified",
                      "pending"
                    ]
                  }
                }
              }
            }
          },
          "payment_evidence": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "method",
              "journal_id",
              "journal_revision",
              "batch_id",
              "batch_revision",
              "invoice_entry_id",
              "invoice_revision",
              "invoice_remaining_amount",
              "funding_bank_id",
              "funding_bank_revision",
              "beneficiary_bank_id",
              "beneficiary_bank_revision",
              "source_revisions",
              "snapshot_sha256"
            ],
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-payment-evidence-v1"
              },
              "method": {
                "type": "string",
                "const": "ledger_cash_same_currency_single_payment_v1"
              },
              "source": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "sandbox",
                  "evaluation_company"
                ],
                "properties": {
                  "sandbox": {
                    "type": "boolean"
                  },
                  "evaluation_company": {
                    "type": "boolean"
                  }
                }
              },
              "journal_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "journal_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "batch_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "batch_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "invoice_entry_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "invoice_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "invoice_remaining_amount": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1000000000000
              },
              "funding_bank_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "funding_bank_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "beneficiary_bank_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "beneficiary_bank_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "source_revisions": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "run",
                  "invoice",
                  "treasury"
                ],
                "properties": {
                  "run": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "invoice": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "treasury": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                }
              },
              "snapshot_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            }
          },
          "posted": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "entry_id",
              "vendor_id",
              "amount",
              "currency",
              "posted_at"
            ],
            "properties": {
              "entry_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "vendor_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "posted_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              }
            }
          }
        },
        "allOf": [
          {
            "if": {
              "required": [
                "payment_evidence"
              ]
            },
            "then": {
              "properties": {
                "erp_type": {
                  "const": "D365_BC"
                },
                "facts": {
                  "type": "object",
                  "required": [
                    "treasury"
                  ],
                  "properties": {
                    "treasury": {
                      "type": "object",
                      "required": [
                        "cash_position",
                        "run_total"
                      ]
                    }
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "erp_type": {
                  "const": "D365_BC"
                }
              },
              "required": [
                "erp_type"
              ]
            },
            "then": {
              "required": [
                "native_context"
              ]
            },
            "else": {
              "not": {
                "required": [
                  "native_context"
                ]
              }
            }
          }
        ]
      },
      "CommerceErpPaymentGuardResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode",
          "enforced",
          "transaction_id",
          "disposition",
          "reason_code",
          "message",
          "policy_version",
          "dossier_id",
          "checks",
          "execution_time_ms"
        ],
        "properties": {
          "authorization": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "attempt_id",
              "expires_at",
              "source_snapshot_sha256"
            ],
            "properties": {
              "attempt_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "source_snapshot_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            }
          },
          "mode": {
            "type": "string",
            "enum": [
              "OBSERVE",
              "ENFORCE"
            ]
          },
          "enforced": {
            "type": "boolean"
          },
          "transaction_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "disposition": {
            "type": "string",
            "enum": [
              "PROCEED",
              "HOLD",
              "BLOCK"
            ]
          },
          "reason_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "policy_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "checks": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "status",
                "verdict",
                "reason_codes",
                "missing_facts"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^P[0-9]{2}$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "evaluated",
                    "missing_facts",
                    "unsupported"
                  ]
                },
                "verdict": {
                  "type": "string",
                  "enum": [
                    "PROCEED",
                    "HOLD",
                    "BLOCK"
                  ]
                },
                "reason_codes": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": "string",
                    "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                  }
                },
                "missing_facts": {
                  "type": "array",
                  "maxItems": 30,
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 180
                  }
                }
              }
            }
          },
          "execution_time_ms": {
            "type": "number",
            "minimum": 0
          },
          "native_context": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "org_id",
              "workspace_environment",
              "connection_id",
              "expected_revision",
              "environment_name",
              "company_id",
              "erp_type",
              "tenant_id",
              "basis",
              "provider_read_authority",
              "execution_available"
            ],
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-native-context-v1"
              },
              "org_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "workspace_environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "connection_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "expected_revision": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2147483647
              },
              "environment_name": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
              },
              "company_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "erp_type": {
                "type": "string",
                "const": "D365_BC"
              },
              "tenant_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "basis": {
                "type": "string",
                "const": "persisted_connection_and_native_grant"
              },
              "provider_read_authority": {
                "type": "string",
                "const": "not_checked"
              },
              "execution_available": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "CommercePaymentWorkspace": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "org_id",
          "workspace_id",
          "environment",
          "source_org_id"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "pattern": "^org_[A-Za-z0-9_-]{1,196}$"
          },
          "workspace_id": {
            "type": "string",
            "pattern": "^ten_[A-Za-z0-9_-]{1,196}$"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "source_org_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          }
        }
      },
      "CommercePaymentWorkspaceRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-payment-workspace-request-v1"
          }
        }
      },
      "CommercePaymentWorkspaceResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "workspace"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-payment-workspace-v1"
          },
          "workspace": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "org_id",
              "workspace_id",
              "environment",
              "source_org_id"
            ],
            "properties": {
              "org_id": {
                "type": "string",
                "pattern": "^org_[A-Za-z0-9_-]{1,196}$"
              },
              "workspace_id": {
                "type": "string",
                "pattern": "^ten_[A-Za-z0-9_-]{1,196}$"
              },
              "environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "source_org_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              }
            }
          }
        }
      },
      "CommercePaymentSnapshot": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "tenant_id",
          "native_context",
          "payment",
          "facts",
          "payment_evidence"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-payment-snapshot-v1"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "native_context": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "org_id",
              "workspace_environment",
              "connection_id",
              "expected_revision",
              "environment_name",
              "company_id"
            ],
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-native-context-v1"
              },
              "org_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "workspace_environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "connection_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "expected_revision": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2147483647
              },
              "environment_name": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
              },
              "company_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              }
            }
          },
          "payment": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "payment_id",
              "vendor_id",
              "amount",
              "currency"
            ],
            "properties": {
              "payment_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "vendor_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "invoice_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "due_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "rail": {
                "type": "string",
                "enum": [
                  "ach",
                  "wire",
                  "card",
                  "stablecoin",
                  "other"
                ]
              }
            }
          },
          "facts": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "observed_at",
              "payment",
              "beneficiary",
              "treasury"
            ],
            "properties": {
              "observed_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "payment": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "prior_payment_count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  }
                },
                "required": [
                  "prior_payment_count"
                ]
              },
              "treasury": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cash_position": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "run_total": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  }
                },
                "required": [
                  "cash_position",
                  "run_total"
                ]
              },
              "beneficiary": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "changed_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "verification": {
                    "type": "string",
                    "const": "unverified"
                  }
                },
                "required": [
                  "changed_at",
                  "verification"
                ]
              }
            }
          },
          "payment_evidence": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "method",
              "journal_id",
              "journal_revision",
              "batch_id",
              "batch_revision",
              "invoice_entry_id",
              "invoice_revision",
              "invoice_remaining_amount",
              "funding_bank_id",
              "funding_bank_revision",
              "beneficiary_bank_id",
              "beneficiary_bank_revision",
              "source_revisions",
              "snapshot_sha256"
            ],
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-payment-evidence-v1"
              },
              "method": {
                "type": "string",
                "const": "ledger_cash_same_currency_single_payment_v1"
              },
              "source": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "sandbox",
                  "evaluation_company"
                ],
                "properties": {
                  "sandbox": {
                    "type": "boolean"
                  },
                  "evaluation_company": {
                    "type": "boolean"
                  }
                }
              },
              "journal_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "journal_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "batch_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "batch_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "invoice_entry_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "invoice_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "invoice_remaining_amount": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1000000000000
              },
              "funding_bank_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "funding_bank_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "beneficiary_bank_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "beneficiary_bank_revision": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,18}$",
                "maxLength": 19
              },
              "source_revisions": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "run",
                  "invoice",
                  "treasury"
                ],
                "properties": {
                  "run": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "invoice": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "treasury": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                }
              },
              "snapshot_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            }
          }
        }
      },
      "CommercePaymentSnapshotRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "native_context",
          "tenant_id",
          "journal_id"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-payment-snapshot-request-v1"
          },
          "native_context": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "org_id",
              "workspace_environment",
              "connection_id",
              "expected_revision",
              "environment_name",
              "company_id"
            ],
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-native-context-v1"
              },
              "org_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "workspace_environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "connection_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "expected_revision": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2147483647
              },
              "environment_name": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
              },
              "company_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              }
            }
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "journal_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          }
        }
      },
      "CommercePaymentSnapshotResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "workspace",
          "snapshot"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-payment-snapshot-response-v1"
          },
          "workspace": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "org_id",
              "workspace_id",
              "environment",
              "source_org_id"
            ],
            "properties": {
              "org_id": {
                "type": "string",
                "pattern": "^org_[A-Za-z0-9_-]{1,196}$"
              },
              "workspace_id": {
                "type": "string",
                "pattern": "^ten_[A-Za-z0-9_-]{1,196}$"
              },
              "environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "source_org_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              }
            }
          },
          "snapshot": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "tenant_id",
              "native_context",
              "payment",
              "facts",
              "payment_evidence"
            ],
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-payment-snapshot-v1"
              },
              "tenant_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "native_context": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "version",
                  "org_id",
                  "workspace_environment",
                  "connection_id",
                  "expected_revision",
                  "environment_name",
                  "company_id"
                ],
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "commerce-native-context-v1"
                  },
                  "org_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "workspace_environment": {
                    "type": "string",
                    "enum": [
                      "sandbox",
                      "production"
                    ]
                  },
                  "connection_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "expected_revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483647
                  },
                  "environment_name": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
                  },
                  "company_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  }
                }
              },
              "payment": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "payment_id",
                  "vendor_id",
                  "amount",
                  "currency"
                ],
                "properties": {
                  "payment_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "vendor_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "invoice_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "due_at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "rail": {
                    "type": "string",
                    "enum": [
                      "ach",
                      "wire",
                      "card",
                      "stablecoin",
                      "other"
                    ]
                  }
                }
              },
              "facts": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "observed_at",
                  "payment",
                  "beneficiary",
                  "treasury"
                ],
                "properties": {
                  "observed_at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "payment": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "prior_payment_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000000
                      }
                    },
                    "required": [
                      "prior_payment_count"
                    ]
                  },
                  "treasury": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "cash_position": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1000000000000
                      },
                      "run_total": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1000000000000
                      }
                    },
                    "required": [
                      "cash_position",
                      "run_total"
                    ]
                  },
                  "beneficiary": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "changed_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "maxLength": 40
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "verification": {
                        "type": "string",
                        "const": "unverified"
                      }
                    },
                    "required": [
                      "changed_at",
                      "verification"
                    ]
                  }
                }
              },
              "payment_evidence": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "version",
                  "method",
                  "journal_id",
                  "journal_revision",
                  "batch_id",
                  "batch_revision",
                  "invoice_entry_id",
                  "invoice_revision",
                  "invoice_remaining_amount",
                  "funding_bank_id",
                  "funding_bank_revision",
                  "beneficiary_bank_id",
                  "beneficiary_bank_revision",
                  "source_revisions",
                  "snapshot_sha256"
                ],
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "commerce-payment-evidence-v1"
                  },
                  "method": {
                    "type": "string",
                    "const": "ledger_cash_same_currency_single_payment_v1"
                  },
                  "source": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "sandbox",
                      "evaluation_company"
                    ],
                    "properties": {
                      "sandbox": {
                        "type": "boolean"
                      },
                      "evaluation_company": {
                        "type": "boolean"
                      }
                    }
                  },
                  "journal_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "journal_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "batch_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "batch_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "invoice_entry_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "invoice_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "invoice_remaining_amount": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000000000
                  },
                  "funding_bank_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "funding_bank_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "beneficiary_bank_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "beneficiary_bank_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "source_revisions": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "run",
                      "invoice",
                      "treasury"
                    ],
                    "properties": {
                      "run": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "invoice": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "treasury": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      }
                    }
                  },
                  "snapshot_sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                }
              }
            }
          }
        }
      },
      "CommercePaymentAuthorizationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "attempt_id",
          "request"
        ],
        "dependencies": {
          "executor": [
            "intent"
          ],
          "intent": [
            "executor"
          ]
        },
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-payment-authorization-v1"
          },
          "attempt_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
          },
          "request": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "transaction_id",
              "erp_type",
              "tenant_id",
              "timestamp",
              "agent_id",
              "mode",
              "payment",
              "facts",
              "native_context",
              "payment_evidence"
            ],
            "properties": {
              "transaction_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              },
              "erp_type": {
                "type": "string",
                "const": "D365_BC"
              },
              "tenant_id": {
                "type": "string",
                "format": "uuid"
              },
              "native_context": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "version",
                  "org_id",
                  "workspace_environment",
                  "connection_id",
                  "expected_revision",
                  "environment_name",
                  "company_id"
                ],
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "commerce-native-context-v1"
                  },
                  "org_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "workspace_environment": {
                    "type": "string",
                    "enum": [
                      "sandbox",
                      "production"
                    ]
                  },
                  "connection_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "expected_revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483647
                  },
                  "environment_name": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
                  },
                  "company_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  }
                }
              },
              "timestamp": {
                "type": "string",
                "format": "date-time"
              },
              "agent_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              },
              "mode": {
                "type": "string",
                "const": "ENFORCE"
              },
              "payment": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "payment_id",
                  "vendor_id",
                  "amount",
                  "currency"
                ],
                "properties": {
                  "payment_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "vendor_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "invoice_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "due_at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "rail": {
                    "type": "string",
                    "enum": [
                      "ach",
                      "wire",
                      "card",
                      "stablecoin",
                      "other"
                    ]
                  }
                }
              },
              "facts": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "observed_at"
                ],
                "properties": {
                  "observed_at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "payment": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "prior_payment_count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000000
                      }
                    }
                  },
                  "treasury": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "cash_position": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1000000000000
                      },
                      "run_total": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1000000000000
                      }
                    }
                  },
                  "beneficiary": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "changed_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "maxLength": 40
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "verification": {
                        "type": "string",
                        "enum": [
                          "verified",
                          "unverified",
                          "pending"
                        ]
                      }
                    }
                  }
                }
              },
              "payment_evidence": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "version",
                  "method",
                  "journal_id",
                  "journal_revision",
                  "batch_id",
                  "batch_revision",
                  "invoice_entry_id",
                  "invoice_revision",
                  "invoice_remaining_amount",
                  "funding_bank_id",
                  "funding_bank_revision",
                  "beneficiary_bank_id",
                  "beneficiary_bank_revision",
                  "source_revisions",
                  "snapshot_sha256"
                ],
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "commerce-payment-evidence-v1"
                  },
                  "method": {
                    "type": "string",
                    "const": "ledger_cash_same_currency_single_payment_v1"
                  },
                  "source": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "sandbox",
                      "evaluation_company"
                    ],
                    "properties": {
                      "sandbox": {
                        "type": "boolean"
                      },
                      "evaluation_company": {
                        "type": "boolean"
                      }
                    }
                  },
                  "journal_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "journal_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "batch_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "batch_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "invoice_entry_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "invoice_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "invoice_remaining_amount": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000000000
                  },
                  "funding_bank_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "funding_bank_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "beneficiary_bank_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  "beneficiary_bank_revision": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "maxLength": 19
                  },
                  "source_revisions": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "run",
                      "invoice",
                      "treasury"
                    ],
                    "properties": {
                      "run": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "invoice": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "treasury": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      }
                    }
                  },
                  "snapshot_sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                }
              },
              "posted": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "entry_id",
                  "vendor_id",
                  "amount",
                  "currency",
                  "posted_at"
                ],
                "properties": {
                  "entry_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "vendor_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "posted_at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  }
                }
              }
            },
            "allOf": [
              {
                "if": {
                  "required": [
                    "payment_evidence"
                  ]
                },
                "then": {
                  "properties": {
                    "erp_type": {
                      "const": "D365_BC"
                    },
                    "facts": {
                      "type": "object",
                      "required": [
                        "treasury"
                      ],
                      "properties": {
                        "treasury": {
                          "type": "object",
                          "required": [
                            "cash_position",
                            "run_total"
                          ]
                        }
                      }
                    }
                  }
                }
              },
              {
                "if": {
                  "properties": {
                    "erp_type": {
                      "const": "D365_BC"
                    }
                  },
                  "required": [
                    "erp_type"
                  ]
                },
                "then": {
                  "required": [
                    "native_context"
                  ]
                },
                "else": {
                  "not": {
                    "required": [
                      "native_context"
                    ]
                  }
                }
              }
            ],
            "not": {
              "required": [
                "posted"
              ]
            }
          },
          "executor": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "platform",
              "style",
              "version"
            ],
            "properties": {
              "platform": {
                "type": "string",
                "const": "business-central"
              },
              "style": {
                "type": "string",
                "const": "permit"
              },
              "version": {
                "type": "string",
                "maxLength": 64,
                "pattern": "^[0-9A-Za-z][0-9A-Za-z.+_-]*$"
              }
            }
          },
          "intent": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "protocol_version",
              "tenant_id",
              "intent_id",
              "captured_at",
              "expires_at",
              "actor",
              "action",
              "context",
              "downstream_target",
              "intent_hash"
            ],
            "properties": {
              "protocol_version": {
                "type": "string",
                "const": "agent-safe.intent/1"
              },
              "tenant_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "intent_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "captured_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "expires_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "actor": {
                "type": "object",
                "maxProperties": 4
              },
              "action": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "type",
                  "resource",
                  "parameters"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "payment.release"
                  },
                  "resource": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "parameters": {
                    "type": "object",
                    "maxProperties": 20
                  }
                }
              },
              "context": {
                "type": "object",
                "required": [
                  "idempotency_key"
                ],
                "maxProperties": 20
              },
              "downstream_target": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "system",
                  "operation"
                ],
                "properties": {
                  "system": {
                    "type": "string",
                    "const": "business-central"
                  },
                  "operation": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "environment": {
                    "type": "string",
                    "enum": [
                      "sandbox",
                      "production"
                    ]
                  },
                  "endpoint": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                }
              },
              "correlation_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "expected_effect_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "intent_hash": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              }
            }
          }
        }
      },
      "CommercePaymentAuthorizationResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode",
          "enforced",
          "transaction_id",
          "disposition",
          "reason_code",
          "message",
          "policy_version",
          "dossier_id",
          "checks",
          "execution_time_ms",
          "native_context",
          "authorization"
        ],
        "properties": {
          "authorization": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "attempt_id",
              "expires_at",
              "source_snapshot_sha256"
            ],
            "properties": {
              "attempt_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "source_snapshot_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            }
          },
          "mode": {
            "type": "string",
            "const": "ENFORCE"
          },
          "enforced": {
            "type": "boolean",
            "const": true
          },
          "transaction_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "disposition": {
            "type": "string",
            "enum": [
              "PROCEED",
              "HOLD",
              "BLOCK"
            ]
          },
          "reason_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "policy_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "dossier_id": {
            "type": "string",
            "format": "uuid"
          },
          "checks": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "status",
                "verdict",
                "reason_codes",
                "missing_facts"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^P[0-9]{2}$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "evaluated",
                    "missing_facts",
                    "unsupported"
                  ]
                },
                "verdict": {
                  "type": "string",
                  "enum": [
                    "PROCEED",
                    "HOLD",
                    "BLOCK"
                  ]
                },
                "reason_codes": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": "string",
                    "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                  }
                },
                "missing_facts": {
                  "type": "array",
                  "maxItems": 30,
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 180
                  }
                }
              }
            }
          },
          "execution_time_ms": {
            "type": "number",
            "minimum": 0
          },
          "native_context": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "org_id",
              "workspace_environment",
              "connection_id",
              "expected_revision",
              "environment_name",
              "company_id",
              "erp_type",
              "tenant_id",
              "basis",
              "provider_read_authority",
              "execution_available"
            ],
            "properties": {
              "version": {
                "type": "string",
                "const": "commerce-native-context-v1"
              },
              "org_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "workspace_environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "connection_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "expected_revision": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2147483647
              },
              "environment_name": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$"
              },
              "company_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "erp_type": {
                "type": "string",
                "const": "D365_BC"
              },
              "tenant_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "basis": {
                "type": "string",
                "const": "persisted_connection_and_native_grant"
              },
              "provider_read_authority": {
                "type": "string",
                "const": "not_checked"
              },
              "execution_available": {
                "type": "boolean"
              }
            }
          },
          "grant": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "decision_id",
              "status",
              "should_execute",
              "reason_codes",
              "action_hash",
              "execution_token",
              "execution_token_jti",
              "execution_token_expires_at",
              "dossier_id"
            ],
            "properties": {
              "decision_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "status": {
                "type": "string",
                "enum": [
                  "ALLOW",
                  "BLOCK",
                  "ESCALATE",
                  "REVIEW_REQUIRED",
                  "ERROR"
                ]
              },
              "should_execute": {
                "type": "boolean"
              },
              "reason_codes": {
                "type": "array",
                "maxItems": 50,
                "items": {
                  "type": "string",
                  "pattern": "^[!-~]{1,200}$"
                }
              },
              "action_hash": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "execution_token": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "execution_token_jti": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "execution_token_expires_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "dossier_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "permit_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
              },
              "intent_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              }
            }
          }
        }
      },
      "CommercePreflightAction": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "PRICE_CHANGE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "sku": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "from_price": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1000000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "to_price": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "estimated_cost": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1000000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  }
                },
                "required": [
                  "sku",
                  "from_price",
                  "to_price"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "INVENTORY_MUTATION"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "sku": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "from": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "to": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "location_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "sku",
                  "from",
                  "to"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "ORDER_ACCEPTANCE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "gross_amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "discount_amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "estimated_cost": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  }
                },
                "required": [
                  "order_id",
                  "gross_amount",
                  "discount_amount",
                  "estimated_cost"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "FULFILLMENT_ACTION"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "acknowledge",
                      "ship",
                      "cancel",
                      "hold"
                    ]
                  }
                },
                "required": [
                  "order_id",
                  "action"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "PROMOTION_CHANGE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "promotion_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "percentage_fraction": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ends_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "combines_with": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "order_discounts": {
                            "type": "boolean"
                          },
                          "product_discounts": {
                            "type": "boolean"
                          },
                          "shipping_discounts": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "order_discounts",
                          "product_discounts",
                          "shipping_discounts"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "promotion_id",
                  "percentage_fraction",
                  "ends_at",
                  "status",
                  "combines_with"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "REFUND_REQUEST"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "reason_code": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "remaining_refundable": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "prior_refund_count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  }
                },
                "required": [
                  "order_id",
                  "amount"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "RETURN_AUTHORIZATION"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "rma_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amount": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1000000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "order_id"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "PAYMENT_RELEASE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "payment_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "vendor_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "invoice_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "due_at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "rail": {
                    "type": "string",
                    "enum": [
                      "ach",
                      "wire",
                      "card",
                      "stablecoin",
                      "other"
                    ]
                  }
                },
                "required": [
                  "payment_id",
                  "vendor_id",
                  "amount",
                  "currency"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "VENDOR_BANK_CHANGE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "vendor_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "change_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "account_hash": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "account_last4": {
                    "type": "string",
                    "pattern": "^[0-9]{4}$"
                  },
                  "previous_account_hash": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "vendor_id",
                  "change_id",
                  "account_hash",
                  "account_last4"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "EARLY_PAYMENT_DISCOUNT"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "payment_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "vendor_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "discount_percent": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "days_early": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  }
                },
                "required": [
                  "payment_id",
                  "vendor_id",
                  "amount",
                  "currency",
                  "discount_percent",
                  "days_early"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "actor": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "HUMAN",
                      "ERP",
                      "REPRICER",
                      "WORKFLOW",
                      "AGENT",
                      "UNKNOWN"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "platform": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idempotency_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 180,
                "pattern": "^[a-z0-9][\\w.:/-]{0,179}$"
              },
              "action_type": {
                "type": "string",
                "const": "CREDIT_HOLD_RELEASE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "customer_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "order_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "exposure_after_release": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000000000
                  }
                },
                "required": [
                  "customer_id",
                  "amount",
                  "currency"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "actor",
              "platform",
              "idempotency_key",
              "action_type",
              "payload"
            ],
            "additionalProperties": false
          }
        ]
      },
      "CommercePreflightFacts": {
        "type": "object",
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "maxLength": 40
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "pricing": {
            "type": "object",
            "properties": {
              "gross_amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "discount_amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "estimated_cost": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              }
            },
            "additionalProperties": false
          },
          "cost_basis": {
            "type": "object",
            "properties": {
              "source_cost": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "system_of_record_cost": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              }
            },
            "additionalProperties": false
          },
          "inventory": {
            "type": "object",
            "properties": {
              "source_on_hand": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "system_on_hand": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "reserved_quantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "requested_quantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              }
            },
            "additionalProperties": false
          },
          "region": {
            "type": "object",
            "properties": {
              "country": {
                "type": "string",
                "pattern": "^[A-Z]{2}$"
              }
            },
            "additionalProperties": false
          },
          "discounts": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 32
              },
              "sources": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120,
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
                },
                "maxItems": 32
              }
            },
            "additionalProperties": false
          },
          "contract": {
            "type": "object",
            "properties": {
              "account_type": {
                "type": "string",
                "enum": [
                  "retail",
                  "b2b"
                ]
              },
              "offered_price": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "contract_price": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              }
            },
            "additionalProperties": false
          },
          "promotion": {
            "type": "object",
            "properties": {
              "discount_codes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120,
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
                },
                "maxItems": 32
              },
              "prior_redemptions": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "account_age_days": {
                "type": "number",
                "minimum": 0,
                "maximum": 100000
              },
              "identity_hash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "additionalProperties": false
          },
          "refund": {
            "type": "object",
            "properties": {
              "remaining_refundable": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "prior_refund_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              }
            },
            "additionalProperties": false
          },
          "lifecycle": {
            "type": "object",
            "properties": {
              "current_state": {
                "type": "string",
                "enum": [
                  "created",
                  "acknowledged",
                  "shipped",
                  "delivered",
                  "cancelled",
                  "refunded",
                  "return_authorized",
                  "returned"
                ]
              },
              "delivered_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "return_eligible": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          "payment": {
            "type": "object",
            "properties": {
              "prior_payment_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "approver_authority_limit": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              }
            },
            "additionalProperties": false
          },
          "beneficiary": {
            "type": "object",
            "properties": {
              "changed_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "verification": {
                "type": "string",
                "enum": [
                  "verified",
                  "unverified",
                  "pending"
                ]
              }
            },
            "additionalProperties": false
          },
          "treasury": {
            "type": "object",
            "properties": {
              "cash_position": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "run_total": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "cost_of_funds_percent": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "AssessmentRecords": {
        "type": "object",
        "description": "decionis.assessments.records/1. Records inline or one JSON Lines file, never both. A commerce record is a commerce-preflight-v2 action with its facts as they stood, its time and its transaction-time money; identifiers in the action should be opaque digests.",
        "required": [
          "version",
          "assessment_id",
          "domain",
          "kind",
          "platform",
          "producer",
          "as_of",
          "window",
          "total",
          "truncated"
        ],
        "additionalProperties": false,
        "properties": {
          "version": {
            "type": "string",
            "const": "decionis.assessments.records/1"
          },
          "assessment_id": {
            "type": "string",
            "format": "uuid"
          },
          "domain": {
            "type": "string",
            "enum": [
              "commerce",
              "cards",
              "agents"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "transaction",
              "event",
              "audit"
            ]
          },
          "platform": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
          },
          "producer": {
            "type": "object",
            "required": [
              "product",
              "surface",
              "version"
            ],
            "additionalProperties": false,
            "properties": {
              "product": {
                "type": "string",
                "enum": [
                  "agentsafe",
                  "commerce",
                  "core"
                ]
              },
              "surface": {
                "type": "string",
                "enum": [
                  "cli",
                  "assistant",
                  "dashboard",
                  "service",
                  "upload"
                ]
              },
              "version": {
                "type": "string"
              }
            }
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "window": {
            "type": "object",
            "required": [
              "from",
              "to"
            ],
            "properties": {
              "from": {
                "type": "string",
                "format": "date-time"
              },
              "to": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "policy_id": {
            "type": "string",
            "format": "uuid",
            "description": "The policy the findings are for; its desk receives them. Without it they go to the workspace's commerce draft (a policy created MANAGED first, then a MANAGED one). Must name a commerce policy in the organization."
          },
          "total": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "truncated": {
            "type": "boolean"
          },
          "records": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5000,
            "items": {
              "type": "object"
            }
          },
          "file": {
            "type": "object",
            "required": [
              "format",
              "content"
            ],
            "additionalProperties": false,
            "properties": {
              "format": {
                "type": "string",
                "const": "jsonl"
              },
              "name": {
                "type": "string"
              },
              "content": {
                "type": "string",
                "maxLength": 4000000
              }
            }
          }
        }
      },
      "AssessmentRecordsResult": {
        "type": "object",
        "required": [
          "version",
          "assessment_id",
          "domain",
          "policy_id",
          "received",
          "assessed",
          "findings"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "decionis.assessments.records/1"
          },
          "assessment_id": {
            "type": "string",
            "format": "uuid"
          },
          "domain": {
            "type": "string",
            "enum": [
              "commerce",
              "cards",
              "agents"
            ]
          },
          "policy_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The policy the findings went to; null for the workspace's commerce draft."
          },
          "received": {
            "type": "integer",
            "description": "Records received, before duplicates were dropped."
          },
          "assessed": {
            "type": "integer"
          },
          "findings": {
            "$ref": "#/components/schemas/SignedAssessmentFindings"
          }
        }
      },
      "AssessmentFindingsSubmission": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "decionis.assessments.submission/1"
          },
          "assessment_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
          },
          "evaluator": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
              },
              "methodology": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "platform",
              "methodology"
            ],
            "additionalProperties": false
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "connected_history",
                  "recorded_evidence"
                ]
              },
              "connection_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "company_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "revision": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "as_of": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "window": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "to": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  }
                },
                "required": [
                  "from",
                  "to"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "kind",
              "connection_id",
              "company_id",
              "revision",
              "as_of",
              "window"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "partial"
            ]
          },
          "coverage": {
            "type": "object",
            "properties": {
              "assessed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "total": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "limit": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "truncated": {
                "type": "boolean"
              },
              "complete": {
                "type": "boolean"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                },
                "maxItems": 30
              },
              "gaps": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                    },
                    "finding_types": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z][A-Za-z0-9]{2,79}$"
                      },
                      "maxItems": 20
                    }
                  },
                  "required": [
                    "code",
                    "finding_types"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 30
              }
            },
            "required": [
              "assessed",
              "total",
              "limit",
              "truncated",
              "complete",
              "reasons",
              "gaps"
            ],
            "additionalProperties": false
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "finding_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120,
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
                },
                "type": {
                  "type": "string",
                  "pattern": "^[A-Z][A-Za-z0-9]{2,79}$"
                },
                "check_id": {
                  "type": "string",
                  "enum": [
                    "P01",
                    "P02",
                    "P03",
                    "P04",
                    "P05",
                    "P06",
                    "P07",
                    "P08",
                    "P09",
                    "P10",
                    "P11",
                    "P12",
                    "P13",
                    "P14",
                    "P15",
                    "P16"
                  ]
                },
                "record_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "occurred_at": {
                  "type": "string",
                  "format": "date-time",
                  "maxLength": 40
                },
                "amount": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "scale": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 6
                    },
                    "amount_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "currency",
                    "scale",
                    "amount_minor"
                  ],
                  "additionalProperties": false
                },
                "measurements": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "number"
                  },
                  "propertyNames": {
                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                  }
                },
                "basis": {
                  "type": "string",
                  "enum": [
                    "source_record",
                    "recorded_observation"
                  ]
                }
              },
              "required": [
                "finding_id",
                "type",
                "check_id",
                "record_digest",
                "occurred_at",
                "amount",
                "measurements",
                "basis"
              ],
              "additionalProperties": false
            },
            "maxItems": 5000
          },
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "record_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "occurred_at": {
                  "type": "string",
                  "format": "date-time",
                  "maxLength": 40
                },
                "amount": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "scale": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 6
                        },
                        "amount_minor": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "currency",
                        "scale",
                        "amount_minor"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "replay": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "$ref": "#/components/schemas/CommercePreflightAction"
                        },
                        "facts": {
                          "$ref": "#/components/schemas/CommercePreflightFacts"
                        }
                      },
                      "required": [
                        "action",
                        "facts"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "record_digest",
                "occurred_at",
                "amount",
                "replay"
              ],
              "additionalProperties": false
            },
            "maxItems": 5000
          }
        },
        "required": [
          "version",
          "assessment_id",
          "platform",
          "evaluator",
          "source",
          "status",
          "coverage",
          "findings",
          "records"
        ],
        "additionalProperties": false
      },
      "SignedAssessmentFindings": {
        "type": "object",
        "properties": {
          "artifact": {
            "type": "object",
            "properties": {
              "assessment_id": {
                "type": "string",
                "format": "uuid"
              },
              "platform": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
              },
              "evaluator": {
                "type": "object",
                "properties": {
                  "platform": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
                  },
                  "methodology": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "required": [
                  "platform",
                  "methodology"
                ],
                "additionalProperties": false
              },
              "source": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "connected_history",
                      "recorded_evidence"
                    ]
                  },
                  "connection_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "company_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "revision": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "as_of": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "window": {
                    "type": "object",
                    "properties": {
                      "from": {
                        "type": "string",
                        "format": "date-time",
                        "maxLength": 40
                      },
                      "to": {
                        "type": "string",
                        "format": "date-time",
                        "maxLength": 40
                      }
                    },
                    "required": [
                      "from",
                      "to"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "connection_id",
                  "company_id",
                  "revision",
                  "as_of",
                  "window"
                ],
                "additionalProperties": false
              },
              "status": {
                "type": "string",
                "enum": [
                  "complete",
                  "partial"
                ]
              },
              "coverage": {
                "type": "object",
                "properties": {
                  "assessed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "total": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "truncated": {
                    "type": "boolean"
                  },
                  "complete": {
                    "type": "boolean"
                  },
                  "reasons": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                    },
                    "maxItems": 30
                  },
                  "gaps": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                        },
                        "finding_types": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Z][A-Za-z0-9]{2,79}$"
                          },
                          "maxItems": 20
                        }
                      },
                      "required": [
                        "code",
                        "finding_types"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 30
                  }
                },
                "required": [
                  "assessed",
                  "total",
                  "limit",
                  "truncated",
                  "complete",
                  "reasons",
                  "gaps"
                ],
                "additionalProperties": false
              },
              "findings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "finding_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
                    },
                    "type": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Za-z0-9]{2,79}$"
                    },
                    "check_id": {
                      "type": "string",
                      "enum": [
                        "P01",
                        "P02",
                        "P03",
                        "P04",
                        "P05",
                        "P06",
                        "P07",
                        "P08",
                        "P09",
                        "P10",
                        "P11",
                        "P12",
                        "P13",
                        "P14",
                        "P15",
                        "P16"
                      ]
                    },
                    "record_digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "occurred_at": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "amount": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "scale": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 6
                        },
                        "amount_minor": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "currency",
                        "scale",
                        "amount_minor"
                      ],
                      "additionalProperties": false
                    },
                    "measurements": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "propertyNames": {
                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                      }
                    },
                    "basis": {
                      "type": "string",
                      "enum": [
                        "source_record",
                        "recorded_observation"
                      ]
                    }
                  },
                  "required": [
                    "finding_id",
                    "type",
                    "check_id",
                    "record_digest",
                    "occurred_at",
                    "amount",
                    "measurements",
                    "basis"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 5000
              },
              "records": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "record_digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "occurred_at": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "amount": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "scale": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 6
                            },
                            "amount_minor": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "currency",
                            "scale",
                            "amount_minor"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replay": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "$ref": "#/components/schemas/CommercePreflightAction"
                            },
                            "facts": {
                              "$ref": "#/components/schemas/CommercePreflightFacts"
                            }
                          },
                          "required": [
                            "action",
                            "facts"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "record_digest",
                    "occurred_at",
                    "amount",
                    "replay"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 5000
              },
              "version": {
                "type": "string",
                "const": "decionis.assessments.findings/1"
              },
              "findings_id": {
                "type": "string",
                "format": "uuid"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "submitted_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "submission_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "totals": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Za-z0-9]{2,79}$"
                    },
                    "check_id": {
                      "type": "string",
                      "enum": [
                        "P01",
                        "P02",
                        "P03",
                        "P04",
                        "P05",
                        "P06",
                        "P07",
                        "P08",
                        "P09",
                        "P10",
                        "P11",
                        "P12",
                        "P13",
                        "P14",
                        "P15",
                        "P16"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "scale": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 6
                    },
                    "amount_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "type",
                    "check_id",
                    "currency",
                    "scale",
                    "amount_minor",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 5000
              }
            },
            "required": [
              "assessment_id",
              "platform",
              "evaluator",
              "source",
              "status",
              "coverage",
              "findings",
              "records",
              "version",
              "findings_id",
              "org_id",
              "submitted_at",
              "submission_sha256",
              "totals"
            ],
            "additionalProperties": false
          },
          "artifact_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "canonicalization": {
            "type": "string",
            "const": "RFC8785/JCS"
          },
          "verification": {
            "type": "string",
            "enum": [
              "signed",
              "unsigned"
            ]
          },
          "signature": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "algorithm": {
                    "type": "string",
                    "const": "Ed25519"
                  },
                  "keyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
                  },
                  "value": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{86}$"
                  }
                },
                "required": [
                  "algorithm",
                  "keyId",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "public_jwks_path": {
            "type": "string",
            "const": "/.well-known/decision-dossier-jwks.json"
          }
        },
        "required": [
          "artifact",
          "artifact_sha256",
          "canonicalization",
          "verification",
          "signature",
          "public_jwks_path"
        ],
        "additionalProperties": false
      },
      "OutcomeAgreementCreate": {
        "type": "object",
        "properties": {
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ]
          },
          "terms": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.outcomes.agreement/1"
              },
              "workflow": {
                "type": "string",
                "enum": [
                  "PAYMENT_SAFETY",
                  "MARGIN_OVERSELL",
                  "SUPPORT",
                  "ENGINEERING"
                ]
              },
              "primary_metric": {
                "type": "string",
                "enum": [
                  "CONFIRMED_PREVENTED_LOSS",
                  "GOVERNED_VALUE"
                ]
              },
              "scope": {
                "type": "object",
                "properties": {
                  "platforms": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
                    },
                    "minItems": 1,
                    "maxItems": 10
                  },
                  "action_types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                    },
                    "minItems": 1,
                    "maxItems": 30
                  },
                  "connection_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "maxItems": 50
                  },
                  "policy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "policy_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "revision_digest": {
                            "type": "string",
                            "pattern": "^sha256:[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "policy_id",
                          "revision_digest"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "platforms",
                  "action_types",
                  "connection_ids",
                  "policy"
                ],
                "additionalProperties": false
              },
              "baseline": {
                "type": "object",
                "properties": {
                  "method": {
                    "type": "string",
                    "enum": [
                      "SHADOW_COMPARISON",
                      "MATCHED_COHORT",
                      "BEFORE_AFTER"
                    ]
                  },
                  "from": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "to": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "method",
                  "from",
                  "to",
                  "description"
                ],
                "additionalProperties": false
              },
              "currency": {
                "type": "object",
                "properties": {
                  "reporting": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "reporting_scale": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "conversion": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "FIXED_RATES"
                    ]
                  },
                  "rates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "rate_micros": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 1000000000000000
                        }
                      },
                      "required": [
                        "currency",
                        "rate_micros"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 30
                  },
                  "source": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "reporting",
                  "reporting_scale",
                  "conversion",
                  "rates",
                  "source"
                ],
                "additionalProperties": false
              },
              "deductions": {
                "type": "object",
                "properties": {
                  "false_hold_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "delay_hour_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "analyst_minute_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "false_hold_minor",
                  "delay_hour_minor",
                  "analyst_minute_minor"
                ],
                "additionalProperties": false
              },
              "confirmation": {
                "type": "string",
                "enum": [
                  "REVIEWER",
                  "CUSTOMER"
                ]
              },
              "exclusions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                    },
                    "description": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    }
                  },
                  "required": [
                    "code",
                    "description"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 30
              },
              "attribution_days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 365
              },
              "period": {
                "type": "object",
                "properties": {
                  "cadence": {
                    "type": "string",
                    "const": "MONTHLY"
                  },
                  "close_after_days": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 60
                  }
                },
                "required": [
                  "cadence",
                  "close_after_days"
                ],
                "additionalProperties": false
              },
              "commercial": {
                "type": "object",
                "properties": {
                  "basis": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "NET_BENEFIT_SHARE",
                      "GOVERNED_VALUE_FEE"
                    ]
                  },
                  "rate_bps": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  },
                  "floor_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "cap_minor": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "basis",
                  "rate_bps",
                  "floor_minor",
                  "cap_minor"
                ],
                "additionalProperties": false
              },
              "effective_from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "effective_to": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "version",
              "workflow",
              "primary_metric",
              "scope",
              "baseline",
              "currency",
              "deductions",
              "confirmation",
              "exclusions",
              "attribution_days",
              "period",
              "commercial",
              "effective_from",
              "effective_to"
            ],
            "additionalProperties": false
          },
          "supersedes": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          }
        },
        "required": [
          "environment",
          "terms"
        ],
        "additionalProperties": false
      },
      "OutcomeAgreementRecord": {
        "type": "object",
        "properties": {
          "artifact": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.outcomes.agreement/1"
              },
              "agreement_id": {
                "type": "string",
                "format": "uuid"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "terms": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "const": "decionis.outcomes.agreement/1"
                  },
                  "workflow": {
                    "type": "string",
                    "enum": [
                      "PAYMENT_SAFETY",
                      "MARGIN_OVERSELL",
                      "SUPPORT",
                      "ENGINEERING"
                    ]
                  },
                  "primary_metric": {
                    "type": "string",
                    "enum": [
                      "CONFIRMED_PREVENTED_LOSS",
                      "GOVERNED_VALUE"
                    ]
                  },
                  "scope": {
                    "type": "object",
                    "properties": {
                      "platforms": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
                        },
                        "minItems": 1,
                        "maxItems": 10
                      },
                      "action_types": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                        },
                        "minItems": 1,
                        "maxItems": 30
                      },
                      "connection_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "maxItems": 50
                      },
                      "policy": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "policy_id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "revision_digest": {
                                "type": "string",
                                "pattern": "^sha256:[a-f0-9]{64}$"
                              }
                            },
                            "required": [
                              "policy_id",
                              "revision_digest"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "platforms",
                      "action_types",
                      "connection_ids",
                      "policy"
                    ],
                    "additionalProperties": false
                  },
                  "baseline": {
                    "type": "object",
                    "properties": {
                      "method": {
                        "type": "string",
                        "enum": [
                          "SHADOW_COMPARISON",
                          "MATCHED_COHORT",
                          "BEFORE_AFTER"
                        ]
                      },
                      "from": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "to": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      }
                    },
                    "required": [
                      "method",
                      "from",
                      "to",
                      "description"
                    ],
                    "additionalProperties": false
                  },
                  "currency": {
                    "type": "object",
                    "properties": {
                      "reporting": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "reporting_scale": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 6
                      },
                      "conversion": {
                        "type": "string",
                        "enum": [
                          "NONE",
                          "FIXED_RATES"
                        ]
                      },
                      "rates": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "rate_micros": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000000000000000
                            }
                          },
                          "required": [
                            "currency",
                            "rate_micros"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 30
                      },
                      "source": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "reporting",
                      "reporting_scale",
                      "conversion",
                      "rates",
                      "source"
                    ],
                    "additionalProperties": false
                  },
                  "deductions": {
                    "type": "object",
                    "properties": {
                      "false_hold_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "delay_hour_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "analyst_minute_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "false_hold_minor",
                      "delay_hour_minor",
                      "analyst_minute_minor"
                    ],
                    "additionalProperties": false
                  },
                  "confirmation": {
                    "type": "string",
                    "enum": [
                      "REVIEWER",
                      "CUSTOMER"
                    ]
                  },
                  "exclusions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        }
                      },
                      "required": [
                        "code",
                        "description"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 30
                  },
                  "attribution_days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  },
                  "period": {
                    "type": "object",
                    "properties": {
                      "cadence": {
                        "type": "string",
                        "const": "MONTHLY"
                      },
                      "close_after_days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 60
                      }
                    },
                    "required": [
                      "cadence",
                      "close_after_days"
                    ],
                    "additionalProperties": false
                  },
                  "commercial": {
                    "type": "object",
                    "properties": {
                      "basis": {
                        "type": "string",
                        "enum": [
                          "NONE",
                          "NET_BENEFIT_SHARE",
                          "GOVERNED_VALUE_FEE"
                        ]
                      },
                      "rate_bps": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      "floor_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "cap_minor": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "basis",
                      "rate_bps",
                      "floor_minor",
                      "cap_minor"
                    ],
                    "additionalProperties": false
                  },
                  "effective_from": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "effective_to": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "version",
                  "workflow",
                  "primary_metric",
                  "scope",
                  "baseline",
                  "currency",
                  "deductions",
                  "confirmation",
                  "exclusions",
                  "attribution_days",
                  "period",
                  "commercial",
                  "effective_from",
                  "effective_to"
                ],
                "additionalProperties": false
              },
              "supersedes": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              }
            },
            "required": [
              "version",
              "agreement_id",
              "org_id",
              "environment",
              "terms",
              "supersedes",
              "created_at"
            ],
            "additionalProperties": false
          },
          "artifact_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "canonicalization": {
            "type": "string",
            "const": "RFC8785/JCS"
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFT",
              "AWAITING_CUSTOMER",
              "ACTIVE",
              "SUPERSEDED",
              "TERMINATED"
            ]
          },
          "decionis_signature": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "algorithm": {
                    "type": "string",
                    "const": "Ed25519"
                  },
                  "keyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
                  },
                  "value": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{86}$"
                  }
                },
                "required": [
                  "algorithm",
                  "keyId",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "customer_signature": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "user_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "method": {
                    "type": "string",
                    "const": "WEBAUTHN"
                  },
                  "proof_reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "proof_sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "signed_at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  }
                },
                "required": [
                  "user_id",
                  "method",
                  "proof_reference",
                  "proof_sha256",
                  "signed_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "public_jwks_path": {
            "type": "string",
            "const": "/.well-known/decision-dossier-jwks.json"
          }
        },
        "required": [
          "artifact",
          "artifact_sha256",
          "canonicalization",
          "state",
          "decionis_signature",
          "customer_signature",
          "public_jwks_path"
        ],
        "additionalProperties": false
      },
      "OutcomeAgreementSignatureRequest": {
        "type": "object",
        "properties": {
          "party": {
            "type": "string",
            "const": "DECIONIS"
          },
          "artifact_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "party",
          "artifact_sha256"
        ],
        "additionalProperties": false
      },
      "SignedOutcomeStatement": {
        "type": "object",
        "properties": {
          "artifact": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.outcomes.statement/1"
              },
              "statement_id": {
                "type": "string",
                "format": "uuid"
              },
              "agreement_id": {
                "type": "string",
                "format": "uuid"
              },
              "agreement_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "period": {
                "type": "string",
                "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
              },
              "window": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "to": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  }
                },
                "required": [
                  "from",
                  "to"
                ],
                "additionalProperties": false
              },
              "closed_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "calculator": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": [
                  "version"
                ],
                "additionalProperties": false
              },
              "totals": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "scale": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 6
                    },
                    "governed_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "prevented_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "held_unconfirmed_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "false_hold_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "pending_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "coverage_gap_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "currency",
                    "scale",
                    "governed_minor",
                    "prevented_minor",
                    "held_unconfirmed_minor",
                    "false_hold_minor",
                    "pending_minor",
                    "coverage_gap_minor"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 30
              },
              "reporting": {
                "type": "object",
                "properties": {
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "scale": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "prevented_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "corrections_minor": {
                    "type": "integer"
                  },
                  "deductions": {
                    "type": "object",
                    "properties": {
                      "false_holds_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "delay_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "analyst_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "total_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "false_holds_minor",
                      "delay_minor",
                      "analyst_minor",
                      "total_minor"
                    ],
                    "additionalProperties": false
                  },
                  "net_benefit_minor": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unconverted_currencies": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "maxItems": 30
                  }
                },
                "required": [
                  "currency",
                  "scale",
                  "prevented_minor",
                  "corrections_minor",
                  "deductions",
                  "net_benefit_minor",
                  "unconverted_currencies"
                ],
                "additionalProperties": false
              },
              "counts": {
                "type": "object",
                "properties": {
                  "evaluated": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "governed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "prevented": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "held_unconfirmed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "false_holds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "pending": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "coverage_gaps": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "estimates": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "excluded": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "disputed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "evaluated",
                  "governed",
                  "prevented",
                  "held_unconfirmed",
                  "false_holds",
                  "pending",
                  "coverage_gaps",
                  "estimates",
                  "excluded",
                  "disputed"
                ],
                "additionalProperties": false
              },
              "estimates": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "scale": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 6
                    },
                    "would_hold_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "currency",
                    "scale",
                    "would_hold_minor",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 30
              },
              "corrections": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "subject_digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "original_period": {
                      "type": "string",
                      "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                    },
                    "from": {
                      "type": "string",
                      "enum": [
                        "GOVERNED",
                        "PREVENTED",
                        "HELD_UNCONFIRMED",
                        "FALSE_HOLD",
                        "PENDING",
                        "COVERAGE_GAP",
                        "ESTIMATE",
                        "EXCLUDED",
                        "DISPUTED"
                      ]
                    },
                    "to": {
                      "type": "string",
                      "enum": [
                        "GOVERNED",
                        "PREVENTED",
                        "HELD_UNCONFIRMED",
                        "FALSE_HOLD",
                        "PENDING",
                        "COVERAGE_GAP",
                        "ESTIMATE",
                        "EXCLUDED",
                        "DISPUTED"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "scale": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 6
                    },
                    "prevented_delta_minor": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "subject_digest",
                    "original_period",
                    "from",
                    "to",
                    "currency",
                    "scale",
                    "prevented_delta_minor"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 5000
              },
              "process_map": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "platform": {
                      "type": "string",
                      "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
                    },
                    "action_type": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "governed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "held": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "desk_reviews": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "customer_reviews": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "median_cycle_minutes": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "p90_cycle_minutes": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "platform",
                    "action_type",
                    "total",
                    "governed",
                    "held",
                    "desk_reviews",
                    "customer_reviews",
                    "median_cycle_minutes",
                    "p90_cycle_minutes"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 200
              },
              "narrative": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 400
                },
                "maxItems": 12
              },
              "entries": {
                "type": "object",
                "properties": {
                  "count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "count",
                  "sha256"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "statement_id",
              "agreement_id",
              "agreement_sha256",
              "org_id",
              "environment",
              "period",
              "window",
              "closed_at",
              "calculator",
              "totals",
              "reporting",
              "counts",
              "estimates",
              "corrections",
              "process_map",
              "narrative",
              "entries"
            ],
            "additionalProperties": false
          },
          "artifact_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "canonicalization": {
            "type": "string",
            "const": "RFC8785/JCS"
          },
          "verification": {
            "type": "string",
            "enum": [
              "signed",
              "unsigned"
            ]
          },
          "signature": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "algorithm": {
                    "type": "string",
                    "const": "Ed25519"
                  },
                  "keyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
                  },
                  "value": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{86}$"
                  }
                },
                "required": [
                  "algorithm",
                  "keyId",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "public_jwks_path": {
            "type": "string",
            "const": "/.well-known/decision-dossier-jwks.json"
          }
        },
        "required": [
          "artifact",
          "artifact_sha256",
          "canonicalization",
          "verification",
          "signature",
          "public_jwks_path"
        ],
        "additionalProperties": false
      },
      "SignedOutcomeDriftReport": {
        "type": "object",
        "properties": {
          "artifact": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.outcomes.drift/1"
              },
              "report_id": {
                "type": "string",
                "format": "uuid"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "period": {
                "type": "string",
                "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
              },
              "window": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  "to": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  }
                },
                "required": [
                  "from",
                  "to"
                ],
                "additionalProperties": false
              },
              "closed_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              },
              "policy_changes": {
                "type": "object",
                "properties": {
                  "releases": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "activations": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "managed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "standard": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "changes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "RELEASE",
                            "ACTIVATION"
                          ]
                        },
                        "policy_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "enum": [
                            "sandbox",
                            "production"
                          ]
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "TESTING",
                            "SHADOW",
                            "PRODUCTION",
                            "ROLLBACK",
                            "RETIREMENT"
                          ]
                        },
                        "from": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "revision_id": {
                                  "type": "string",
                                  "format": "uuid"
                                },
                                "number": {
                                  "type": "integer",
                                  "minimum": 1
                                },
                                "digest": {
                                  "type": "string",
                                  "pattern": "^sha256:[a-f0-9]{64}$"
                                }
                              },
                              "required": [
                                "revision_id",
                                "number",
                                "digest"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "to": {
                          "type": "object",
                          "properties": {
                            "revision_id": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "number": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "digest": {
                              "type": "string",
                              "pattern": "^sha256:[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "revision_id",
                            "number",
                            "digest"
                          ],
                          "additionalProperties": false
                        },
                        "release_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "release_digest": {
                          "type": "string",
                          "pattern": "^sha256:[a-f0-9]{64}$"
                        },
                        "deployment_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "deployment_digest": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^sha256:[a-f0-9]{64}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "approvals": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "user_id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "role": {
                                "type": "string",
                                "pattern": "^[A-Z][A-Z_]{0,63}$"
                              },
                              "at": {
                                "type": "string",
                                "format": "date-time",
                                "maxLength": 40
                              }
                            },
                            "required": [
                              "user_id",
                              "role",
                              "at"
                            ],
                            "additionalProperties": false
                          },
                          "maxItems": 50
                        },
                        "activated_by": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "governance_profile": {
                          "type": "string",
                          "enum": [
                            "MANAGED",
                            "STANDARD"
                          ]
                        },
                        "at": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        }
                      },
                      "required": [
                        "kind",
                        "policy_id",
                        "environment",
                        "action",
                        "from",
                        "to",
                        "release_id",
                        "release_digest",
                        "deployment_id",
                        "deployment_digest",
                        "approvals",
                        "activated_by",
                        "governance_profile",
                        "at"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 500
                  },
                  "truncated": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "releases",
                  "activations",
                  "managed",
                  "standard",
                  "changes",
                  "truncated"
                ],
                "additionalProperties": false
              },
              "shadow": {
                "type": "object",
                "properties": {
                  "basis": {
                    "type": "string",
                    "const": "ESTIMATE"
                  },
                  "observations": {
                    "type": "object",
                    "properties": {
                      "evaluations": {
                        "type": "object",
                        "properties": {
                          "SHADOW": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "PARALLEL": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "SHADOW",
                          "PARALLEL"
                        ],
                        "additionalProperties": false
                      },
                      "disagreements": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "by_type": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "decision_type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1000
                            },
                            "mode": {
                              "type": "string",
                              "enum": [
                                "SHADOW",
                                "PARALLEL"
                              ]
                            },
                            "shadow_verdict": {
                              "type": "string",
                              "enum": [
                                "ESCALATE",
                                "REJECT",
                                "REVIEW"
                              ]
                            },
                            "verdict_effect": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "OBSERVED",
                                    "BINDING"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "count": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "decision_type",
                            "mode",
                            "shadow_verdict",
                            "verdict_effect",
                            "count"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 500
                      },
                      "truncated": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "evaluations",
                      "disagreements",
                      "by_type",
                      "truncated"
                    ],
                    "additionalProperties": false
                  },
                  "replays": {
                    "type": "object",
                    "properties": {
                      "compared": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "differing": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "by_type": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "decision_type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1000
                            },
                            "enforced_verdict": {
                              "type": "string",
                              "enum": [
                                "APPROVE",
                                "ESCALATE",
                                "REJECT",
                                "REVIEW"
                              ]
                            },
                            "shadow_verdict": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "APPROVE",
                                    "ESCALATE",
                                    "REJECT",
                                    "REVIEW"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "count": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "decision_type",
                            "enforced_verdict",
                            "shadow_verdict",
                            "count"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 500
                      },
                      "truncated": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "compared",
                      "differing",
                      "by_type",
                      "truncated"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "basis",
                  "observations",
                  "replays"
                ],
                "additionalProperties": false
              },
              "coverage": {
                "type": "object",
                "properties": {
                  "ungoverned": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "observed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "sources": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_.:-]{0,99}$"
                            },
                            "status": {
                              "type": "string",
                              "const": "reported"
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            },
                            "records": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "ungoverned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "observed": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "gaps": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "platform": {
                                    "type": "string",
                                    "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
                                  },
                                  "action_type": {
                                    "type": "string",
                                    "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                                  },
                                  "coverage": {
                                    "type": "string",
                                    "enum": [
                                      "UNGOVERNED",
                                      "OBSERVED"
                                    ]
                                  },
                                  "count": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "platform",
                                  "action_type",
                                  "coverage",
                                  "count"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 500
                            }
                          },
                          "required": [
                            "source",
                            "status",
                            "description",
                            "records",
                            "ungoverned",
                            "observed",
                            "gaps"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_.:-]{0,99}$"
                            },
                            "status": {
                              "type": "string",
                              "const": "not_reported"
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "source",
                            "status",
                            "description"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "maxItems": 100
                  }
                },
                "required": [
                  "ungoverned",
                  "observed",
                  "sources"
                ],
                "additionalProperties": false
              },
              "narrative": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 400
                },
                "maxItems": 12
              },
              "inputs": {
                "type": "object",
                "properties": {
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "sources": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_.:-]{0,99}$"
                        },
                        "records": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "sha256": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        }
                      },
                      "required": [
                        "source",
                        "records",
                        "sha256"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100
                  }
                },
                "required": [
                  "sha256",
                  "sources"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "report_id",
              "org_id",
              "period",
              "window",
              "closed_at",
              "policy_changes",
              "shadow",
              "coverage",
              "narrative",
              "inputs"
            ],
            "additionalProperties": false
          },
          "artifact_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "canonicalization": {
            "type": "string",
            "const": "RFC8785/JCS"
          },
          "verification": {
            "type": "string",
            "enum": [
              "signed",
              "unsigned"
            ]
          },
          "signature": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "algorithm": {
                    "type": "string",
                    "const": "Ed25519"
                  },
                  "keyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
                  },
                  "value": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{86}$"
                  }
                },
                "required": [
                  "algorithm",
                  "keyId",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "public_jwks_path": {
            "type": "string",
            "const": "/.well-known/decision-dossier-jwks.json"
          }
        },
        "required": [
          "artifact",
          "artifact_sha256",
          "canonicalization",
          "verification",
          "signature",
          "public_jwks_path"
        ],
        "additionalProperties": false
      },
      "OutcomeEvidenceSubmission": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "decionis.outcomes.submission/1"
          },
          "producer": {
            "type": "string",
            "enum": [
              "commerce",
              "agentsafe"
            ]
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "string",
                  "const": "decionis.outcomes.evidence/1"
                },
                "subject_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "revision": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 10000
                },
                "platform": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
                },
                "connection_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "action_type": {
                  "type": "string",
                  "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                },
                "occurred_at": {
                  "type": "string",
                  "format": "date-time",
                  "maxLength": 40
                },
                "amount": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "scale": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 6
                    },
                    "amount_minor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "currency",
                    "scale",
                    "amount_minor"
                  ],
                  "additionalProperties": false
                },
                "coverage": {
                  "type": "string",
                  "enum": [
                    "GOVERNED",
                    "UNGOVERNED",
                    "OBSERVED"
                  ]
                },
                "decision": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "decision_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dossier_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "disposition": {
                          "type": "string",
                          "enum": [
                            "PROCEED",
                            "HOLD",
                            "BLOCK"
                          ]
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "SHADOW",
                            "PARALLEL",
                            "ENFORCEMENT"
                          ]
                        },
                        "decided_at": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "reason_codes": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                          },
                          "maxItems": 30
                        }
                      },
                      "required": [
                        "decision_id",
                        "dossier_id",
                        "disposition",
                        "mode",
                        "decided_at",
                        "reason_codes"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "review": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "case_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "outcome": {
                          "type": "string",
                          "enum": [
                            "RELEASED",
                            "REJECTED"
                          ]
                        },
                        "confirmation": {
                          "type": "string",
                          "enum": [
                            "CONFIRMED_PROBLEM",
                            "LEGITIMATE",
                            "UNCONFIRMED"
                          ]
                        },
                        "confirmed_by": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "REVIEWER",
                                "CUSTOMER"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "reviewer": {
                          "type": "string",
                          "enum": [
                            "DESK",
                            "CUSTOMER"
                          ]
                        },
                        "decided_at": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "analyst_minutes": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10000
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "case_id",
                        "outcome",
                        "confirmation",
                        "confirmed_by",
                        "reviewer",
                        "decided_at",
                        "analyst_minutes"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "execution": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "COMMITTED",
                            "FAILED",
                            "NOT_EXECUTED",
                            "UNKNOWN"
                          ]
                        },
                        "grant_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "receipt_sha256": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "at": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        }
                      },
                      "required": [
                        "status",
                        "grant_id",
                        "receipt_sha256",
                        "at"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "financial": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "SETTLED",
                            "REVERSED",
                            "PENDING",
                            "UNKNOWN"
                          ]
                        },
                        "amount": {
                          "type": "object",
                          "properties": {
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "scale": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 6
                            },
                            "amount_minor": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "currency",
                            "scale",
                            "amount_minor"
                          ],
                          "additionalProperties": false
                        },
                        "at": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        }
                      },
                      "required": [
                        "status",
                        "amount",
                        "at"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "exclusion_codes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                  },
                  "maxItems": 10
                },
                "source_sha256": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                }
              },
              "required": [
                "version",
                "subject_digest",
                "revision",
                "platform",
                "connection_id",
                "action_type",
                "occurred_at",
                "amount",
                "coverage",
                "decision",
                "review",
                "execution",
                "financial",
                "exclusion_codes",
                "source_sha256"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 1000
          }
        },
        "required": [
          "version",
          "producer",
          "org_id",
          "evidence"
        ],
        "additionalProperties": false
      },
      "SignedOutcomeCharge": {
        "type": "object",
        "properties": {
          "artifact": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.outcomes.charge/1"
              },
              "charge_id": {
                "type": "string",
                "format": "uuid"
              },
              "statement_id": {
                "type": "string",
                "format": "uuid"
              },
              "statement_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "agreement_id": {
                "type": "string",
                "format": "uuid"
              },
              "agreement_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "period": {
                "type": "string",
                "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
              },
              "basis": {
                "type": "string",
                "enum": [
                  "NET_BENEFIT_SHARE",
                  "GOVERNED_VALUE_FEE"
                ]
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "scale": {
                "type": "integer",
                "minimum": 0,
                "maximum": 6
              },
              "carried_in_minor": {
                "type": "integer",
                "maximum": 0
              },
              "base_minor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "rate_bps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000
              },
              "computed_minor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "floor_minor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "cap_minor": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "amount_minor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "above_floor_minor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "carried_out_minor": {
                "type": "integer",
                "maximum": 0
              },
              "disputed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "issued_at": {
                "type": "string",
                "format": "date-time",
                "maxLength": 40
              }
            },
            "required": [
              "version",
              "charge_id",
              "statement_id",
              "statement_sha256",
              "agreement_id",
              "agreement_sha256",
              "org_id",
              "period",
              "basis",
              "currency",
              "scale",
              "carried_in_minor",
              "base_minor",
              "rate_bps",
              "computed_minor",
              "floor_minor",
              "cap_minor",
              "amount_minor",
              "above_floor_minor",
              "carried_out_minor",
              "disputed",
              "issued_at"
            ],
            "additionalProperties": false
          },
          "artifact_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "canonicalization": {
            "type": "string",
            "const": "RFC8785/JCS"
          },
          "signature": {
            "type": "object",
            "properties": {
              "algorithm": {
                "type": "string",
                "const": "Ed25519"
              },
              "keyId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
              },
              "value": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{86}$"
              }
            },
            "required": [
              "algorithm",
              "keyId",
              "value"
            ],
            "additionalProperties": false
          },
          "public_jwks_path": {
            "type": "string",
            "const": "/.well-known/decision-dossier-jwks.json"
          }
        },
        "required": [
          "artifact",
          "artifact_sha256",
          "canonicalization",
          "signature",
          "public_jwks_path"
        ],
        "additionalProperties": false
      },
      "MicrosoftPlatformWorkspaceMapping": {
        "type": "object",
        "description": "accounts-microsoft-workspace-v1, exactly as Accounts signed it; account_org_id and account_workspace_id are ExternalAccountIds.organization/workspace(\"decionis\", source_org_id).",
        "additionalProperties": false,
        "required": [
          "version",
          "platform",
          "source_org_id",
          "subscription_id",
          "account_org_id",
          "account_workspace_id",
          "account_user_id",
          "account_membership_id",
          "account_entitlement_id",
          "product",
          "environment",
          "display_name",
          "issued_at"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "accounts-microsoft-workspace-v1"
          },
          "platform": {
            "type": "string",
            "const": "microsoft"
          },
          "source_org_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          },
          "subscription_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "account_user_id": {
            "type": "string",
            "pattern": "^usr_[a-f0-9]{24}$"
          },
          "account_membership_id": {
            "type": "string",
            "pattern": "^mem_[a-f0-9]{24}$"
          },
          "account_entitlement_id": {
            "type": "string",
            "pattern": "^ent_[a-f0-9]{24}$"
          },
          "product": {
            "type": "string",
            "const": "decionis"
          },
          "environment": {
            "type": "string",
            "const": "production"
          },
          "display_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160,
            "description": "One line."
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MicrosoftPlatformOrganizationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mapping",
          "evidence"
        ],
        "properties": {
          "subscription": {
            "$ref": "#/components/schemas/MicrosoftPlatformSubscriptionState"
          },
          "mapping": {
            "$ref": "#/components/schemas/MicrosoftPlatformWorkspaceMapping"
          },
          "evidence": {
            "type": "object",
            "description": "Ed25519 signature (base64url) over the canonical mapping, with its SHA-256, verifiable at the Accounts /.well-known/account-jwks.json.",
            "additionalProperties": false,
            "required": [
              "algorithm",
              "key_id",
              "payload_sha256",
              "signature"
            ],
            "properties": {
              "algorithm": {
                "type": "string",
                "const": "Ed25519"
              },
              "key_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "payload_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "signature": {
                "type": "string",
                "minLength": 40,
                "maxLength": 200
              }
            }
          }
        }
      },
      "MicrosoftPlatformOrganization": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "org_id",
          "account_org_id",
          "account_workspace_id"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "provisioned",
              "replayed"
            ]
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "description": "Always the mapping's source_org_id."
          },
          "account_org_id": {
            "type": "string",
            "pattern": "^org_[a-f0-9]{20}$"
          },
          "account_workspace_id": {
            "type": "string",
            "pattern": "^ten_[a-f0-9]{20}$"
          },
          "subscription": {
            "description": "Present when the request carried the subscription's state: what it did. A conflicting state is reported here (outcome conflict) and never fails the provisioning.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MicrosoftPlatformSubscriptionOutcome"
              }
            ]
          }
        }
      },
      "MicrosoftPlatformSubscriptionState": {
        "type": "object",
        "description": "core-microsoft-subscription-v1: one numbered state of a decionis-platform subscription. Commerce maps the Microsoft plan to plan_code by exact plan id in its registry; revision grows with every change it records for the subscription.",
        "additionalProperties": false,
        "required": [
          "version",
          "offer_id",
          "plan_id",
          "plan_code",
          "status",
          "revision"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "core-microsoft-subscription-v1"
          },
          "offer_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$"
          },
          "plan_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$"
          },
          "plan_code": {
            "type": "string",
            "description": "A paid Core plan; any other code is 422 plan_unknown.",
            "enum": [
              "build",
              "starter",
              "defence",
              "premium",
              "scale",
              "enterprise"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "SUBSCRIBED",
              "SUSPENDED",
              "UNSUBSCRIBED"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "MicrosoftPlatformSubscriptionOutcome": {
        "type": "object",
        "required": [
          "outcome"
        ],
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "replayed",
              "stale",
              "conflict"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "subscription",
              "revision",
              "ended"
            ],
            "description": "Only with outcome conflict."
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "The organization's current revision."
          },
          "projected": {
            "type": "boolean",
            "description": "False while another billing source holds the organization's entitlement."
          },
          "entitlement": {
            "type": "object",
            "nullable": true,
            "required": [
              "plan_code",
              "decision_limit_monthly",
              "api_access",
              "source"
            ],
            "properties": {
              "plan_code": {
                "type": "string"
              },
              "decision_limit_monthly": {
                "type": "integer",
                "nullable": true
              },
              "api_access": {
                "type": "boolean"
              },
              "source": {
                "type": "string"
              }
            }
          }
        }
      },
      "MicrosoftPlatformSubscription": {
        "allOf": [
          {
            "$ref": "#/components/schemas/MicrosoftPlatformSubscriptionOutcome"
          },
          {
            "type": "object",
            "required": [
              "org_id",
              "subscription_id"
            ],
            "properties": {
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "subscription_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        ]
      },
      "OutcomeChargeReceipt": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "decionis.outcomes.receipt/1"
          },
          "platform": {
            "type": "string",
            "enum": [
              "microsoft",
              "aws"
            ]
          },
          "subscription_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "plan_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "dimension": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,100}$"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000
          },
          "unit_minor": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000
          },
          "status": {
            "type": "string",
            "enum": [
              "ACCEPTED",
              "DUPLICATE",
              "NOTHING_TO_BILL"
            ]
          },
          "usage_reference": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "reported_at": {
            "type": "string",
            "format": "date-time",
            "maxLength": 40
          }
        },
        "required": [
          "version",
          "platform",
          "subscription_id",
          "plan_id",
          "dimension",
          "quantity",
          "unit_minor",
          "status",
          "usage_reference",
          "reported_at"
        ],
        "additionalProperties": false
      },
      "OutcomeDispute": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "dispute_id",
          "subject_digest",
          "reason",
          "opened_at",
          "state",
          "resolution_note",
          "resolved_at"
        ],
        "properties": {
          "dispute_id": {
            "type": "string",
            "format": "uuid"
          },
          "subject_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "OPEN",
              "UPHELD",
              "REJECTED"
            ]
          },
          "resolution_note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          },
          "resolved_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "DecisionExplanation": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "decionis.decisions.explanation/1"
          },
          "decision_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "disposition": {
            "type": "string",
            "enum": [
              "HOLD",
              "BLOCK",
              "ESCALATE"
            ]
          },
          "customer_safe": {
            "type": "object",
            "properties": {
              "summary": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "next_step": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              }
            },
            "required": [
              "summary",
              "next_step"
            ],
            "additionalProperties": false
          },
          "internal": {
            "type": "object",
            "properties": {
              "reason_codes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                },
                "maxItems": 60
              },
              "check_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "P01",
                    "P02",
                    "P03",
                    "P04",
                    "P05",
                    "P06",
                    "P07",
                    "P08",
                    "P09",
                    "P10",
                    "P11",
                    "P12",
                    "P13",
                    "P14",
                    "P15",
                    "P16"
                  ]
                },
                "maxItems": 16
              },
              "dossier_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "reason_codes",
              "check_ids",
              "dossier_id"
            ],
            "additionalProperties": false
          },
          "generated_by": {
            "type": "string",
            "const": "decionis.explanations.catalog/1"
          }
        },
        "required": [
          "version",
          "decision_id",
          "disposition",
          "customer_safe",
          "internal",
          "generated_by"
        ],
        "additionalProperties": false
      },
      "CommercePaymentHistory": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-payment-history-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "minimum": 1
          },
          "company_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "maxLength": 40
          },
          "window": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          "payments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "payment_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "vendor_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "document_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "posting_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "scale": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 6
                },
                "amount_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "recipient_account_digest": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "payment_digest",
                "vendor_digest",
                "document_digest",
                "posting_date",
                "currency",
                "scale",
                "amount_minor",
                "recipient_account_digest"
              ],
              "additionalProperties": false
            },
            "maxItems": 2000
          },
          "invoices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "invoice_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "vendor_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "external_document_digest": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "posting_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "due_date": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "scale": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 6
                },
                "amount_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "discount_date": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "discount_possible_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "discount_taken_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "closed_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "invoice_digest",
                "vendor_digest",
                "external_document_digest",
                "posting_date",
                "due_date",
                "currency",
                "scale",
                "amount_minor",
                "discount_date",
                "discount_possible_minor",
                "discount_taken_minor",
                "closed_at"
              ],
              "additionalProperties": false
            },
            "maxItems": 4000
          },
          "applications": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "payment_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "invoice_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "applied_on": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "amount_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "payment_digest",
                "invoice_digest",
                "applied_on",
                "amount_minor"
              ],
              "additionalProperties": false
            },
            "maxItems": 8000
          },
          "bank_changes": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "CHANGE_LOG_DISABLED",
                      "VENDOR_BANK_ACCOUNTS_NOT_LOGGED",
                      "CHANGE_LOG_UNREADABLE"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "logged_from": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "entries": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "vendor_digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "account_digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "changed_at": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "change": {
                      "type": "string",
                      "enum": [
                        "INSERTED",
                        "MODIFIED"
                      ]
                    }
                  },
                  "required": [
                    "vendor_digest",
                    "account_digest",
                    "changed_at",
                    "change"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 2000
              }
            },
            "required": [
              "available",
              "reason",
              "logged_from",
              "entries"
            ],
            "additionalProperties": false
          },
          "coverage": {
            "type": "object",
            "properties": {
              "complete": {
                "type": "boolean"
              },
              "truncated": {
                "type": "boolean"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                },
                "maxItems": 20
              }
            },
            "required": [
              "complete",
              "truncated",
              "reasons"
            ],
            "additionalProperties": false
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "connection_id",
          "connection_revision",
          "company_id",
          "observed_at",
          "window",
          "payments",
          "invoices",
          "applications",
          "bank_changes",
          "coverage",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "CommerceSalesHistory": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "commerce-sales-history-v1"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "minimum": 1
          },
          "company_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "maxLength": 40
          },
          "window": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          "orders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "document_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "order_digest": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "external_document_digest": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "document_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "scale": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 6
                },
                "amount_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "document_digest",
                "order_digest",
                "external_document_digest",
                "document_date",
                "currency",
                "scale",
                "amount_minor"
              ],
              "additionalProperties": false
            },
            "maxItems": 4000
          },
          "invoices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "document_digest": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "order_digest": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "external_document_digest": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "document_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "scale": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 6
                },
                "amount_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "document_digest",
                "order_digest",
                "external_document_digest",
                "document_date",
                "currency",
                "scale",
                "amount_minor"
              ],
              "additionalProperties": false
            },
            "maxItems": 8000
          },
          "coverage": {
            "type": "object",
            "properties": {
              "complete": {
                "type": "boolean"
              },
              "truncated": {
                "type": "boolean"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                },
                "maxItems": 20
              }
            },
            "required": [
              "complete",
              "truncated",
              "reasons"
            ],
            "additionalProperties": false
          },
          "execution_available": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "version",
          "org_id",
          "connection_id",
          "connection_revision",
          "company_id",
          "observed_at",
          "window",
          "orders",
          "invoices",
          "coverage",
          "execution_available"
        ],
        "additionalProperties": false
      },
      "PolicyDocumentDraftRequest": {
        "type": "object",
        "properties": {
          "expectedSequence": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "modelId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "modelVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "sourceIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 20
          },
          "intent": {
            "type": "string",
            "minLength": 1,
            "maxLength": 12000
          }
        },
        "required": [
          "expectedSequence",
          "modelId",
          "modelVersion",
          "sourceIds",
          "intent"
        ],
        "additionalProperties": false
      },
      "PolicyFindingsDraftRequest": {
        "type": "object",
        "properties": {
          "expectedSequence": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "findingsIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 20
          },
          "modelId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "modelVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "intent": {
            "type": "string",
            "minLength": 1,
            "maxLength": 12000
          }
        },
        "required": [
          "expectedSequence",
          "findingsIds"
        ],
        "additionalProperties": false
      },
      "PolicyProposalDecision": {
        "type": "object",
        "properties": {
          "expectedSequence": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "action": {
            "type": "string",
            "enum": [
              "ACCEPT",
              "REJECT",
              "SPLIT"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "ruleIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "maxItems": 120,
            "default": []
          }
        },
        "required": [
          "expectedSequence",
          "action",
          "reason"
        ],
        "additionalProperties": false
      },
      "ActionManifest": {
        "type": "object",
        "description": "`agent-safe.actions/1`: the actions an executor can run, as AgentSafe's `agentsafe actions manifest` exports them from its handler registry and its API and MCP profiles. Actions are unique and sorted in code-point order, so one manifest has one digest (SHA-256 over its RFC 8785 form). A policy revision carries it as `content.actionManifest`; a release cut from the revision records `actionManifestDigest`, and assurance fails with `ACTION_COVERAGE_INCOMPLETE` while a manifest action has no scenario naming it (`context.agent_safe.action.type`) that a rule other than the default matches.",
        "required": [
          "manifest",
          "actions"
        ],
        "additionalProperties": false,
        "properties": {
          "manifest": {
            "type": "string",
            "const": "agent-safe.actions/1"
          },
          "actions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/ActionManifestEntry"
            }
          }
        }
      },
      "ActionManifestEntry": {
        "type": "object",
        "required": [
          "action",
          "source",
          "parameters",
          "targets",
          "effect_type"
        ],
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-z][a-z0-9._:-]*$"
          },
          "source": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "kind",
                  "family"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "registry"
                  },
                  "family": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9]{0,39}$"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "kind",
                  "profile",
                  "operations"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "api"
                  },
                  "profile": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "operations": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 200,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "kind",
                  "profile",
                  "tool"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "mcp"
                  },
                  "profile": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "tool": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                }
              }
            ]
          },
          "parameters": {
            "type": "object",
            "description": "The JSON Schema the executor's admission holds the intent's parameters to.",
            "additionalProperties": true
          },
          "targets": {
            "type": "array",
            "description": "Target scope templates with `{name}` placeholders; empty when the proposal names the target.",
            "maxItems": 64,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "effect_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "The effect the action produces, when its source declares one.",
            "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
          }
        }
      },
      "PolicyAssumption": {
        "type": "object",
        "description": "An interpretation the encoded rules rest on, recorded with the draft and carried, as written, into the signed release manifest (`assumptions`). `invalidatedBy` names the material signal whose open value says the assumption no longer holds.",
        "required": [
          "id",
          "text",
          "invalidatedBy"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "invalidatedBy": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:/-]{0,199}$"
          }
        }
      },
      "PolicyInvariant": {
        "type": "object",
        "description": "An organisation invariant (\"no production administrative port is opened to 0.0.0.0/0\"): compiled to one scenario per combination of the `vary` values, each a copy of `input` with `decision_type` set to `decisionType` and each varied field written at its dotted path. At most 100 scenarios; a field is varied once, never inside another, never `decision_type`, and never through a prototype name.",
        "required": [
          "id",
          "statement",
          "decisionDomain",
          "decisionType",
          "input",
          "vary"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
          },
          "statement": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "decisionDomain": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]{0,99}$"
          },
          "decisionType": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "input": {
            "type": "object",
            "additionalProperties": true
          },
          "vary": {
            "type": "array",
            "maxItems": 6,
            "items": {
              "type": "object",
              "required": [
                "field",
                "values"
              ],
              "additionalProperties": false,
              "properties": {
                "field": {
                  "type": "string",
                  "maxLength": 200,
                  "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                },
                "values": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 500
                  }
                }
              }
            }
          }
        }
      },
      "PolicyInvariantEntry": {
        "type": "object",
        "required": [
          "record",
          "digest",
          "retirement"
        ],
        "additionalProperties": false,
        "properties": {
          "record": {
            "type": "object",
            "required": [
              "schemaVersion",
              "kind",
              "id",
              "orgId",
              "environment",
              "invariant",
              "declaredBy",
              "declaredAt",
              "reason"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "const": 1
              },
              "kind": {
                "type": "string",
                "const": "decionis.policy-invariant/v1"
              },
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "orgId": {
                "type": "string",
                "format": "uuid"
              },
              "environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              "invariant": {
                "$ref": "#/components/schemas/PolicyInvariant"
              },
              "declaredBy": {
                "type": "string",
                "format": "uuid"
              },
              "declaredAt": {
                "type": "string",
                "format": "date-time"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "digest": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "retirement": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "record",
                  "digest"
                ],
                "additionalProperties": false,
                "properties": {
                  "record": {
                    "type": "object",
                    "required": [
                      "schemaVersion",
                      "kind",
                      "invariantRecordId",
                      "invariantDigest",
                      "retiredBy",
                      "retiredAt",
                      "reason"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "schemaVersion": {
                        "type": "integer",
                        "const": 1
                      },
                      "kind": {
                        "type": "string",
                        "const": "decionis.policy-invariant-retirement/v1"
                      },
                      "invariantRecordId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "invariantDigest": {
                        "type": "string",
                        "pattern": "^sha256:[a-f0-9]{64}$"
                      },
                      "retiredBy": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "retiredAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "reason": {
                        "type": "string"
                      }
                    }
                  },
                  "digest": {
                    "type": "string",
                    "pattern": "^sha256:[a-f0-9]{64}$"
                  }
                }
              }
            ]
          }
        }
      },
      "PolicyProposalReplay": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "decionis.policy.proposal.replay/1"
          },
          "policy_id": {
            "type": "string",
            "format": "uuid"
          },
          "proposal_id": {
            "type": "string",
            "format": "uuid"
          },
          "replayed_at": {
            "type": "string",
            "format": "date-time"
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "findings_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "assessment_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "verification": {
                  "type": "string",
                  "enum": [
                    "signed",
                    "unsigned"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "complete",
                    "partial"
                  ]
                },
                "gaps": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "maxItems": 30
                }
              },
              "required": [
                "findings_id",
                "assessment_id",
                "verification",
                "status",
                "gaps"
              ],
              "additionalProperties": false
            },
            "maxItems": 20
          },
          "replay": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string",
                "const": "decionis.assessments.replay/1"
              },
              "evaluator_version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "current_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "proposed_digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "identical_configuration": {
                "type": "boolean"
              },
              "scope": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "P01",
                    "P02",
                    "P03",
                    "P04",
                    "P05",
                    "P06",
                    "P07",
                    "P08",
                    "P09",
                    "P10",
                    "P11",
                    "P12",
                    "P13",
                    "P14",
                    "P15",
                    "P16"
                  ]
                },
                "maxItems": 16
              },
              "assumptions": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                },
                "maxItems": 10
              },
              "categories": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "category": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "totals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "scale": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "records": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "amount_minor": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "current": {
                            "type": "object",
                            "properties": {
                              "stopped": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "stopped_amount_minor": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "held": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "blocked": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "stopped",
                              "stopped_amount_minor",
                              "held",
                              "blocked"
                            ],
                            "additionalProperties": false
                          },
                          "proposed": {
                            "type": "object",
                            "properties": {
                              "stopped": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "stopped_amount_minor": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "held": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "blocked": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "stopped",
                              "stopped_amount_minor",
                              "held",
                              "blocked"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "currency",
                          "scale",
                          "records",
                          "amount_minor",
                          "current",
                          "proposed"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "category",
                    "totals"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 40
              },
              "false_holds": {
                "type": "object",
                "properties": {
                  "basis": {
                    "type": "string",
                    "const": "held_without_exposure_finding"
                  },
                  "current": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "scale": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 6
                        },
                        "count": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "amount_minor": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "currency",
                        "scale",
                        "count",
                        "amount_minor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "proposed": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "scale": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 6
                        },
                        "count": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "amount_minor": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "currency",
                        "scale",
                        "count",
                        "amount_minor"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "basis",
                  "current",
                  "proposed"
                ],
                "additionalProperties": false
              },
              "changes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "record_digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "maxItems": 20
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "amount_minor": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "current": {
                      "type": "string",
                      "enum": [
                        "PROCEED",
                        "HOLD",
                        "BLOCK"
                      ]
                    },
                    "proposed": {
                      "type": "string",
                      "enum": [
                        "PROCEED",
                        "HOLD",
                        "BLOCK"
                      ]
                    }
                  },
                  "required": [
                    "record_digest",
                    "categories",
                    "currency",
                    "amount_minor",
                    "current",
                    "proposed"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 200
              },
              "coverage": {
                "type": "object",
                "properties": {
                  "assessed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "replayed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "out_of_scope": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "not_replayable": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "record_limit": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "change_limit": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "changes_truncated": {
                    "type": "boolean"
                  },
                  "truncated": {
                    "type": "boolean"
                  },
                  "complete": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "assessed",
                  "replayed",
                  "out_of_scope",
                  "not_replayable",
                  "record_limit",
                  "change_limit",
                  "changes_truncated",
                  "truncated",
                  "complete"
                ],
                "additionalProperties": false
              },
              "no_downstream_action_executed": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "version",
              "evaluator_version",
              "current_digest",
              "proposed_digest",
              "identical_configuration",
              "scope",
              "assumptions",
              "categories",
              "false_holds",
              "changes",
              "coverage",
              "no_downstream_action_executed"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "version",
          "policy_id",
          "proposal_id",
          "replayed_at",
          "findings",
          "replay"
        ],
        "additionalProperties": false
      }
    }
  }
}