# Complete REST API reference

Generated from the same registry as https://economi.co/openapi.json.

For agents: start with https://economi.co/docs/agents/ and the concepts at
https://economi.co/docs/concepts/agent/index.md. Authenticate for resource
https://economi.co/mcp, list businesses, and fetch /v1/openapi.json with the
selected business header before using any operation below. This public
reference grants no access. Commands marked browser require a signed-in human.
Never put credentials in prompts. Rehearse writes only in a disposable sandbox.

Resolve local $ref values against the Components section. For /v1/commands,
select the request oneOf variant whose name.const matches the command; use
GET /v1/catalog/commands/{name} for its permitted live schema. For reports,
select the variant whose kind.const matches the report. Preserve integer-string
amounts, stable idempotency keys, and the documented date window.

## Default security


```json
[
  {
    "bearerAuth": []
  }
]
```

## POST /v1/platform/purchases

Operation: platform.purchase


```json
{
  "operationId": "platform.purchase",
  "description": "Discover and accept an exact Solo extra-events, Founders or Startup agreement, prepare its invoice, recover status and open invoices, or explicitly pay a saved card with action=pay and method=card. MPP and x402 payment use the separate paymentUrl. The authenticated business is the target. A full-access agent acting for its current owner can accept; wallet policy governs payment. Status may finish paid activation. On prepare, fundingAccountId may name a live USD account for Link/Stripe or company-owned token wallet for direct Tempo; without it wallet activation can finish while customer payment bookkeeping waits. Correct the choice on prepare until the buyer payment commits. Payment credentials are never purchase arguments. Responses include a paymentUrl and browserFallback when available.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "offer",
                "accept",
                "prepare",
                "status",
                "pay"
              ]
            },
            "plan": {
              "type": "string",
              "enum": [
                "founders",
                "team",
                "events"
              ]
            },
            "interval": {
              "type": "string",
              "enum": [
                "month",
                "year"
              ]
            },
            "offerId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "invoiceId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "fundingAccountId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "invoiceCursor": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "offerCid": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "capacity": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "authorized": {
              "type": "boolean"
            },
            "method": {
              "type": "string",
              "enum": [
                "card",
                "mpp",
                "x402"
              ]
            }
          },
          "required": [
            "action"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/platform/purchases/{offerId}/payment

Operation: platform.pay


```json
{
  "operationId": "platform.pay",
  "description": "Pay the prepared invoice with an offered MPP or x402 method. Keep OAuth Authorization: Bearer; send MPP's complete Payment credential in the separate Payment header, or an x402 credential in PAYMENT-SIGNATURE. Omit the request body. Retry pending outcomes through purchase status before trying another method. A 402 is a wallet challenge, not payment consent or proof of settlement.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "offerId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "method",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "enum": [
          "mpp",
          "x402"
        ]
      }
    },
    {
      "name": "invoiceId",
      "in": "query",
      "required": false,
      "description": "The ordinary renewal or extra-event invoice to pay, when supplied by the purchase response.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "Payment",
      "in": "header",
      "required": false,
      "description": "MPP Payment credential; independent of the OAuth Authorization header.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "PAYMENT-SIGNATURE",
      "in": "header",
      "required": false,
      "description": "x402 payment signature; independent of the OAuth Authorization header.",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "202": {
      "description": "Payment outcome is pending; recover status before collecting again.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "MPP or x402 payment challenge.",
      "content": {
        "application/json": {
          "schema": {}
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        },
        "PAYMENT-REQUIRED": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "x-payment-info": {
    "price": {
      "mode": "dynamic",
      "currency": "USD"
    },
    "protocols": [
      {
        "mpp": {
          "method": "stripe",
          "intent": "charge",
          "currency": "usd"
        }
      },
      {
        "mpp": {
          "method": "tempo",
          "intent": "charge",
          "currency": "usd"
        }
      },
      {
        "x402": {}
      }
    ],
    "offers": [
      {
        "method": "stripe",
        "intent": "charge",
        "currency": "usd",
        "description": "Pay the prepared plan or extra-events invoice with a Stripe shared payment token (Link or card) when the MPP challenge offers it. The amount is that invoice's amount on the runtime 402 challenge, not a fixed per-call price."
      },
      {
        "method": "tempo",
        "intent": "charge",
        "currency": "usd",
        "description": "Pay the same invoice with a Tempo transfer when the MPP challenge offers Tempo. The challenge names the token. The amount is that invoice's amount on the runtime 402 challenge, not a fixed per-call price."
      }
    ]
  }
}
```

## GET /v1/plan-publications

Operation: plan_publications.list


```json
{
  "operationId": "plan_publications.list",
  "description": "List the versions this business has published to the vendor catalog, newest first, with their status (published or withdrawn). The business owner publishes, in person or through an agent connected interactively with public.manage.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## POST /v1/plan-publications

Operation: plan_publications.publish


```json
{
  "operationId": "plan_publications.publish",
  "description": "Publish a previewed bundle to the vendor catalog. Send the preview's publish object, optionally with domain and method to prove a domain. A version is never edited: publish a new version with supersedes and summary to change or reinstate a plan. A retry with the same input delivers the same version. The business owner publishes, in person or through an agent connected interactively with public.manage.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "templateId": {
              "type": "string",
              "minLength": 1
            },
            "planKey": {
              "description": "preview/publish: the plan's stable key in the catalog. Default plan.",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "effectiveFrom": {
              "description": "preview/publish: YYYY-MM-DD the prices apply from. Default today (UTC).",
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "readOn": {
              "description": "preview/publish: YYYY-MM-DD the pricing page was read. Default today (UTC); publish with the value preview returned.",
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "pricingUrl": {
              "type": "string"
            },
            "shelf": {
              "description": "preview/publish: vendors (a plan customers adopt) or patterns (a business model pattern). Default vendors.",
              "type": "string",
              "enum": [
                "vendors",
                "patterns"
              ]
            },
            "supersedes": {
              "description": "preview/publish: the CID of the version this one replaces. Requires summary. A withdrawn version can be superseded.",
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "summary": {
              "description": "preview/publish: what changed from the superseded version.",
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "expectedCid": {
              "type": "string",
              "minLength": 1
            },
            "domain": {
              "description": "publish: a domain to prove control of, re-checked on every publication.",
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            },
            "method": {
              "description": "publish: how the domain proves it. Default well-known.",
              "type": "string",
              "enum": [
                "dns",
                "well-known"
              ]
            },
            "vendor": {
              "description": "publish: the catalog vendor the domain claim selects. Default from the domain.",
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "required": [
            "templateId",
            "pricingUrl",
            "expectedCid"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/plan-publications/preview

Operation: plan_publications.preview


```json
{
  "operationId": "plan_publications.preview",
  "description": "Build the exact public bundle and CID an active on-sale template would publish, without publishing. The reply's publish object is the input for plan_publications.publish. The business owner publishes, in person or through an agent connected interactively with public.manage.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "templateId": {
              "type": "string",
              "minLength": 1
            },
            "planKey": {
              "description": "preview/publish: the plan's stable key in the catalog. Default plan.",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "effectiveFrom": {
              "description": "preview/publish: YYYY-MM-DD the prices apply from. Default today (UTC).",
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "readOn": {
              "description": "preview/publish: YYYY-MM-DD the pricing page was read. Default today (UTC); publish with the value preview returned.",
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "pricingUrl": {
              "type": "string"
            },
            "shelf": {
              "description": "preview/publish: vendors (a plan customers adopt) or patterns (a business model pattern). Default vendors.",
              "type": "string",
              "enum": [
                "vendors",
                "patterns"
              ]
            },
            "supersedes": {
              "description": "preview/publish: the CID of the version this one replaces. Requires summary. A withdrawn version can be superseded.",
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "summary": {
              "description": "preview/publish: what changed from the superseded version.",
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "required": [
            "templateId",
            "pricingUrl"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/plan-publications/withdrawals

Operation: plan_publications.withdraw


```json
{
  "operationId": "plan_publications.withdraw",
  "description": "Withdraw a version this business published from new adoptions. It stays readable by CID and its adopters keep it; a later version can supersede it. The business owner publishes, in person or through an agent connected interactively with public.manage.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "cid": {
              "type": "string",
              "minLength": 1
            },
            "reason": {
              "description": "withdraw: why, shown on the version. Default Withdrawn by publisher.",
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "required": [
            "cid"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/commands

Operation: commands.execute


```json
{
  "operationId": "commands.execute",
  "description": "Execute a public command. Retry with the same idempotency_key to retrieve the accepted receipt. Only active businesses may write.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "oneOf": [
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "accounts.archive"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "financialAccountId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "accounts.register"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "openingBalance": {
                      "type": "string",
                      "pattern": "^-?(0|[1-9][0-9]*)$",
                      "description": "Exact signed minor units at the start of openingDate. Positive is money held for a bank/wallet, amount owed for a card. Use with openingDate, including for zero."
                    },
                    "openingDate": {
                      "type": "string",
                      "format": "date",
                      "description": "YYYY-MM-DD, inclusive start of the account's books (UTC). Earlier payments and journals are refused."
                    },
                    "openingEquityAccountCode": {
                      "type": "integer",
                      "description": "Postable equity chart account for the other side; defaults to 3900 Opening balance equity."
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 1
                    },
                    "glAccountCode": {
                      "enum": [
                        1110,
                        1310,
                        1410,
                        2190
                      ]
                    },
                    "kind": {
                      "enum": [
                        "checking",
                        "savings",
                        "card",
                        "wallet",
                        "other"
                      ]
                    },
                    "isDefault": {
                      "type": "boolean"
                    },
                    "ownerPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "providerPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "providerContractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "last4": {
                      "type": "string",
                      "pattern": "^[0-9]{4}$"
                    },
                    "network": {
                      "type": "string",
                      "minLength": 1
                    },
                    "brandColor": {
                      "type": "string",
                      "pattern": "^#[0-9A-Fa-f]{6}$",
                      "description": "The issuer's brand color as #RRGGBB, drawn as the account's card or plate."
                    },
                    "logoDocumentId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The issuer's logo: the documentId of an image document (documents.receive kind image, PNG/JPEG/WebP)."
                    }
                  },
                  "required": [
                    "financialAccountId",
                    "name",
                    "currency"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "accounts.restore"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "financialAccountId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "accounts.set_opening_balance"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "openingBalance": {
                      "type": "string",
                      "pattern": "^-?(0|[1-9][0-9]*)$",
                      "description": "Exact signed minor units at the start of openingDate. Positive is money held for a bank/wallet, amount owed for a card. Use with openingDate, including for zero."
                    },
                    "openingDate": {
                      "type": "string",
                      "format": "date",
                      "description": "YYYY-MM-DD, inclusive start of the account's books (UTC). Earlier payments and journals are refused."
                    },
                    "openingEquityAccountCode": {
                      "type": "integer",
                      "description": "Postable equity chart account for the other side; defaults to 3900 Opening balance equity."
                    }
                  },
                  "required": [
                    "financialAccountId",
                    "openingBalance",
                    "openingDate"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "accounts.update"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "kind": {
                      "enum": [
                        "checking",
                        "savings",
                        "card",
                        "wallet",
                        "other"
                      ]
                    },
                    "isDefault": {
                      "type": "boolean"
                    },
                    "providerPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "providerContractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "last4": {
                      "type": "string",
                      "pattern": "^[0-9]{4}$"
                    },
                    "network": {
                      "type": "string",
                      "minLength": 1
                    },
                    "brandColor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^#[0-9A-Fa-f]{6}$",
                          "description": "The issuer's brand color as #RRGGBB, drawn as the account's card or plate."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "logoDocumentId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "description": "The issuer's logo: the documentId of an image document (documents.receive kind image, PNG/JPEG/WebP)."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "financialAccountId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "activities.archive"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "id",
                    "expectedDocumentId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind activity, template that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "activities.create"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "definition": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "model": {
                          "const": "priced-rights-v1"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1
                        },
                        "externalReferences": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "terms": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "type": {
                                "enum": [
                                  "integer",
                                  "text",
                                  "date",
                                  "instant"
                                ]
                              },
                              "unit": {
                                "type": "string",
                                "minLength": 1
                              },
                              "default": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "type"
                            ]
                          }
                        },
                        "facts": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "anyOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "type": {
                                    "enum": [
                                      "integer",
                                      "text",
                                      "date",
                                      "instant"
                                    ]
                                  },
                                  "unit": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "type": {
                                    "enum": [
                                      "claim",
                                      "occurrence"
                                    ]
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          }
                        },
                        "ledgers": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "classification": {
                                "enum": [
                                  "gaap",
                                  "contractual",
                                  "operational",
                                  "ownership",
                                  "planning"
                                ]
                              },
                              "unitKind": {
                                "enum": [
                                  "currency",
                                  "share",
                                  "usage",
                                  "credit",
                                  "right",
                                  "token",
                                  "other"
                                ]
                              },
                              "unitCode": {
                                "type": "string",
                                "minLength": 1
                              },
                              "decimals": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 18
                              },
                              "accountTemplate": {
                                "enum": [
                                  "gaap_startup",
                                  "contract_flow",
                                  "capacity",
                                  "meter",
                                  "entitlement",
                                  "issued_instrument"
                                ]
                              }
                            },
                            "required": [
                              "classification",
                              "unitKind",
                              "unitCode",
                              "decimals",
                              "accountTemplate"
                            ]
                          }
                        },
                        "price": {
                          "anyOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "treatment": {
                                  "const": "priced"
                                },
                                "calculation": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "fixed"
                                        },
                                        "amount": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "amount"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "capacity_excess"
                                        },
                                        "consumptionFact": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "rate": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        },
                                        "unitsPerPrice": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "consumptionFact",
                                        "rate",
                                        "unitsPerPrice"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "rate"
                                        },
                                        "quantity": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        },
                                        "rate": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        },
                                        "unitsPerPrice": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "quantity",
                                        "rate",
                                        "unitsPerPrice"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "tiered"
                                        },
                                        "quantity": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        },
                                        "mode": {
                                          "enum": [
                                            "volume",
                                            "graduated"
                                          ]
                                        },
                                        "tiers": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "upTo": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "rate": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "unitsPerPrice": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "flat": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "wholeUnits": {
                                                "type": "boolean"
                                              },
                                              "startedUnits": {
                                                "type": "boolean"
                                              }
                                            },
                                            "required": [
                                              "rate"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 100
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "quantity",
                                        "mode",
                                        "tiers"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "sum"
                                        },
                                        "components": {
                                          "type": "array",
                                          "items": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "fixed"
                                                  },
                                                  "amount": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "amount"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "rate"
                                                  },
                                                  "quantity": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  },
                                                  "rate": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  },
                                                  "unitsPerPrice": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "quantity",
                                                  "rate",
                                                  "unitsPerPrice"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "tiered"
                                                  },
                                                  "quantity": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  },
                                                  "mode": {
                                                    "enum": [
                                                      "volume",
                                                      "graduated"
                                                    ]
                                                  },
                                                  "tiers": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "upTo": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "rate": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "unitsPerPrice": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "flat": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "wholeUnits": {
                                                          "type": "boolean"
                                                        },
                                                        "startedUnits": {
                                                          "type": "boolean"
                                                        }
                                                      },
                                                      "required": [
                                                        "rate"
                                                      ]
                                                    },
                                                    "minItems": 1,
                                                    "maxItems": 100
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "quantity",
                                                  "mode",
                                                  "tiers"
                                                ]
                                              }
                                            ]
                                          },
                                          "minItems": 2,
                                          "maxItems": 20
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "components"
                                      ]
                                    }
                                  ]
                                },
                                "currencyTerm": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "reductions": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "basisPoints": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "fromTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "untilTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "rounding": {
                                        "enum": [
                                          "half_up",
                                          "floor"
                                        ]
                                      },
                                      "appliesTo": {
                                        "enum": [
                                          "recurring"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "fromTerm"
                                    ]
                                  },
                                  "minItems": 1,
                                  "maxItems": 4
                                }
                              },
                              "required": [
                                "treatment",
                                "calculation",
                                "currencyTerm"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "treatment": {
                                  "enum": [
                                    "included",
                                    "free",
                                    "promotional"
                                  ]
                                },
                                "evidence": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "kind": {
                                        "enum": [
                                          "tap_message",
                                          "x402_receipt",
                                          "chain_tx",
                                          "signed_doc",
                                          "stripe_object",
                                          "other"
                                        ]
                                      },
                                      "ref": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "signer": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "ref"
                                    ]
                                  },
                                  "minItems": 1,
                                  "maxItems": 20
                                }
                              },
                              "required": [
                                "treatment",
                                "evidence"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "treatment": {
                                  "const": "unknown"
                                },
                                "evidence": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "kind": {
                                        "enum": [
                                          "tap_message",
                                          "x402_receipt",
                                          "chain_tx",
                                          "signed_doc",
                                          "stripe_object",
                                          "other"
                                        ]
                                      },
                                      "ref": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "signer": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "ref"
                                    ]
                                  },
                                  "minItems": 1,
                                  "maxItems": 20
                                },
                                "knownAmountTerm": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "treatment",
                                "evidence"
                              ]
                            }
                          ]
                        },
                        "recurringValue": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "interval": {
                              "enum": [
                                "monthly",
                                "yearly"
                              ]
                            },
                            "startTerm": {
                              "type": "string",
                              "minLength": 1
                            },
                            "endTerm": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "interval",
                            "startTerm"
                          ]
                        },
                        "usage": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "quantityFact": {
                              "type": "string",
                              "minLength": 1
                            },
                            "schedule": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "startTerm": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "anchorTerm": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "endTerm": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "everyMonths": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "timing": {
                                  "enum": [
                                    "start",
                                    "end"
                                  ]
                                },
                                "offsetDays": {
                                  "type": "integer",
                                  "minimum": -365,
                                  "maximum": 365
                                },
                                "serviceEvidence": {
                                  "const": "elapsed_time"
                                }
                              },
                              "required": [
                                "startTerm",
                                "everyMonths",
                                "timing",
                                "offsetDays"
                              ]
                            },
                            "estimate": {
                              "enum": [
                                "priced",
                                "observed_amount",
                                "none"
                              ]
                            },
                            "amountDecimals": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9
                            },
                            "allocation": {
                              "enum": [
                                "estimate",
                                "quantity"
                              ]
                            },
                            "customerFunction": {
                              "enum": [
                                "cost_of_revenue",
                                "research_and_development",
                                "sales_and_marketing",
                                "general_and_administrative",
                                "other"
                              ]
                            },
                            "roundingTolerance": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            }
                          },
                          "required": [
                            "quantityFact",
                            "schedule",
                            "estimate",
                            "allocation"
                          ]
                        },
                        "lot": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "origin": {
                              "enum": [
                                "bought",
                                "granted"
                              ]
                            },
                            "ledger": {
                              "type": "string",
                              "minLength": 1
                            },
                            "face": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            },
                            "expiresAt": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            },
                            "effectiveAt": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            },
                            "coverageBps": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            },
                            "taxPosition": {
                              "enum": [
                                "reduces_tax_base",
                                "excludes_tax",
                                "includes_tax"
                              ]
                            },
                            "refundOnClose": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "origin",
                            "ledger",
                            "face",
                            "taxPosition",
                            "refundOnClose"
                          ]
                        },
                        "economics": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "quantity": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "term": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "minimum": {
                                  "type": "string",
                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                },
                                "periodQuantity": {
                                  "enum": [
                                    "at_start",
                                    "at_end",
                                    "maximum",
                                    "time_weighted"
                                  ]
                                },
                                "proration": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "basis": {
                                      "enum": [
                                        "actual_days",
                                        "elapsed",
                                        "days_365",
                                        "days_30",
                                        "true_up_windows",
                                        "stated",
                                        "none"
                                      ]
                                    },
                                    "rounding": {
                                      "enum": [
                                        "half_up",
                                        "down",
                                        "up"
                                      ]
                                    },
                                    "per": {
                                      "enum": [
                                        "change",
                                        "unit"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "basis",
                                    "rounding",
                                    "per"
                                  ]
                                },
                                "increase": {
                                  "enum": [
                                    "now",
                                    "next_period"
                                  ]
                                },
                                "decrease": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "credit_now"
                                        },
                                        "credit": {
                                          "enum": [
                                            "refund",
                                            "vendor_credit"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "credit"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "enum": [
                                            "no_credit",
                                            "next_period",
                                            "at_renewal"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "within_days"
                                        },
                                        "days": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 31
                                        },
                                        "credit": {
                                          "enum": [
                                            "refund",
                                            "vendor_credit"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "days",
                                        "credit"
                                      ]
                                    }
                                  ]
                                },
                                "billedOn": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "on": {
                                          "enum": [
                                            "change",
                                            "next_bill"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "on"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "on": {
                                          "const": "true_up"
                                        },
                                        "everyMonths": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 120
                                        },
                                        "anchor": {
                                          "enum": [
                                            "billing",
                                            "calendar"
                                          ]
                                        },
                                        "measure": {
                                          "enum": [
                                            "changes",
                                            "maximum"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "on",
                                        "everyMonths",
                                        "anchor",
                                        "measure"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "term",
                                "periodQuantity",
                                "proration",
                                "increase",
                                "decrease",
                                "billedOn"
                              ]
                            },
                            "kind": {
                              "enum": [
                                "service",
                                "capacity",
                                "ownership",
                                "financing",
                                "distribution"
                              ]
                            },
                            "direction": {
                              "enum": [
                                "provide",
                                "receive"
                              ]
                            },
                            "safe": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "valuationBasis": {
                                      "enum": [
                                        "post_money",
                                        "pre_money"
                                      ]
                                    },
                                    "capTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "discountPpmTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "valuationBasis",
                                    "capTerm"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "valuationBasis": {
                                      "enum": [
                                        "post_money",
                                        "pre_money"
                                      ]
                                    },
                                    "discountPpmTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": []
                                }
                              ]
                            },
                            "billing": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "timing": {
                                  "enum": [
                                    "advance",
                                    "arrears",
                                    "upfront"
                                  ]
                                },
                                "schedule": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "startTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "anchorTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "endTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    },
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 366
                                    },
                                    "timing": {
                                      "enum": [
                                        "start",
                                        "end"
                                      ]
                                    },
                                    "offsetDays": {
                                      "type": "integer",
                                      "minimum": -365,
                                      "maximum": 365
                                    },
                                    "serviceEvidence": {
                                      "const": "elapsed_time"
                                    }
                                  },
                                  "required": [
                                    "startTerm",
                                    "timing",
                                    "offsetDays"
                                  ],
                                  "oneOf": [
                                    {
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                },
                                "on": {
                                  "enum": [
                                    "accept",
                                    "cancel",
                                    "terminate"
                                  ]
                                },
                                "automatic": {
                                  "type": "boolean"
                                },
                                "dueDays": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 365
                                },
                                "factsDueDays": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 90
                                },
                                "factsFrom": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                }
                              },
                              "required": [
                                "timing"
                              ]
                            },
                            "recognition": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "timing": {
                                  "enum": [
                                    "delivery",
                                    "usage",
                                    "ratable"
                                  ]
                                },
                                "allocation": {
                                  "enum": [
                                    "equal_periods"
                                  ]
                                },
                                "schedule": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "startTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "anchorTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "endTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    },
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 366
                                    },
                                    "timing": {
                                      "enum": [
                                        "start",
                                        "end"
                                      ]
                                    },
                                    "offsetDays": {
                                      "type": "integer",
                                      "minimum": -365,
                                      "maximum": 365
                                    },
                                    "serviceEvidence": {
                                      "const": "elapsed_time"
                                    }
                                  },
                                  "required": [
                                    "startTerm",
                                    "timing",
                                    "offsetDays"
                                  ],
                                  "oneOf": [
                                    {
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                },
                                "on": {
                                  "enum": [
                                    "accept",
                                    "cancel",
                                    "terminate"
                                  ]
                                }
                              },
                              "required": [
                                "timing"
                              ]
                            },
                            "consideration": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "money"
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                    },
                                    "currencyTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "recognition": {
                                      "enum": [
                                        "unconditional_obligation",
                                        "condition_satisfied"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "amount",
                                    "currencyTerm",
                                    "recognition"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "units"
                                    },
                                    "quantity": {
                                      "type": "string",
                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                    },
                                    "ledger": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "quantity",
                                    "ledger"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "claim"
                                    },
                                    "claimFact": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                    },
                                    "currencyTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "claimFact",
                                    "amount",
                                    "currencyTerm"
                                  ]
                                }
                              ]
                            },
                            "classification": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "monetaryLedger": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "capitalAccount": {
                                  "enum": [
                                    3100,
                                    3110,
                                    3120
                                  ]
                                },
                                "revenueCategory": {
                                  "enum": [
                                    "services",
                                    "subscription",
                                    "consulting",
                                    "usage",
                                    "grant"
                                  ]
                                },
                                "expenseAccount": {
                                  "type": "integer"
                                },
                                "expenseFunction": {
                                  "enum": [
                                    "cost_of_revenue",
                                    "research_and_development",
                                    "sales_and_marketing",
                                    "general_and_administrative",
                                    "other"
                                  ]
                                },
                                "product": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "taxCode": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "taxTreatment": {
                                  "enum": [
                                    "inclusive",
                                    "exclusive"
                                  ]
                                }
                              },
                              "required": [
                                "monetaryLedger"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "direction"
                          ]
                        }
                      },
                      "required": [
                        "model",
                        "name",
                        "price",
                        "economics"
                      ]
                    }
                  },
                  "required": [
                    "definition"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind activity, template, contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "activities.replace"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "definition": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "model": {
                          "const": "priced-rights-v1"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1
                        },
                        "externalReferences": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "terms": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "type": {
                                "enum": [
                                  "integer",
                                  "text",
                                  "date",
                                  "instant"
                                ]
                              },
                              "unit": {
                                "type": "string",
                                "minLength": 1
                              },
                              "default": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "type"
                            ]
                          }
                        },
                        "facts": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "anyOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "type": {
                                    "enum": [
                                      "integer",
                                      "text",
                                      "date",
                                      "instant"
                                    ]
                                  },
                                  "unit": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "type": {
                                    "enum": [
                                      "claim",
                                      "occurrence"
                                    ]
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          }
                        },
                        "ledgers": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "classification": {
                                "enum": [
                                  "gaap",
                                  "contractual",
                                  "operational",
                                  "ownership",
                                  "planning"
                                ]
                              },
                              "unitKind": {
                                "enum": [
                                  "currency",
                                  "share",
                                  "usage",
                                  "credit",
                                  "right",
                                  "token",
                                  "other"
                                ]
                              },
                              "unitCode": {
                                "type": "string",
                                "minLength": 1
                              },
                              "decimals": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 18
                              },
                              "accountTemplate": {
                                "enum": [
                                  "gaap_startup",
                                  "contract_flow",
                                  "capacity",
                                  "meter",
                                  "entitlement",
                                  "issued_instrument"
                                ]
                              }
                            },
                            "required": [
                              "classification",
                              "unitKind",
                              "unitCode",
                              "decimals",
                              "accountTemplate"
                            ]
                          }
                        },
                        "price": {
                          "anyOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "treatment": {
                                  "const": "priced"
                                },
                                "calculation": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "fixed"
                                        },
                                        "amount": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "amount"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "capacity_excess"
                                        },
                                        "consumptionFact": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "rate": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        },
                                        "unitsPerPrice": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "consumptionFact",
                                        "rate",
                                        "unitsPerPrice"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "rate"
                                        },
                                        "quantity": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        },
                                        "rate": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        },
                                        "unitsPerPrice": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "quantity",
                                        "rate",
                                        "unitsPerPrice"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "tiered"
                                        },
                                        "quantity": {
                                          "type": "string",
                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                        },
                                        "mode": {
                                          "enum": [
                                            "volume",
                                            "graduated"
                                          ]
                                        },
                                        "tiers": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "upTo": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "rate": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "unitsPerPrice": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "flat": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "wholeUnits": {
                                                "type": "boolean"
                                              },
                                              "startedUnits": {
                                                "type": "boolean"
                                              }
                                            },
                                            "required": [
                                              "rate"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 100
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "quantity",
                                        "mode",
                                        "tiers"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "sum"
                                        },
                                        "components": {
                                          "type": "array",
                                          "items": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "fixed"
                                                  },
                                                  "amount": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "amount"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "rate"
                                                  },
                                                  "quantity": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  },
                                                  "rate": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  },
                                                  "unitsPerPrice": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "quantity",
                                                  "rate",
                                                  "unitsPerPrice"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "tiered"
                                                  },
                                                  "quantity": {
                                                    "type": "string",
                                                    "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                  },
                                                  "mode": {
                                                    "enum": [
                                                      "volume",
                                                      "graduated"
                                                    ]
                                                  },
                                                  "tiers": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "upTo": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "rate": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "unitsPerPrice": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "flat": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "wholeUnits": {
                                                          "type": "boolean"
                                                        },
                                                        "startedUnits": {
                                                          "type": "boolean"
                                                        }
                                                      },
                                                      "required": [
                                                        "rate"
                                                      ]
                                                    },
                                                    "minItems": 1,
                                                    "maxItems": 100
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "quantity",
                                                  "mode",
                                                  "tiers"
                                                ]
                                              }
                                            ]
                                          },
                                          "minItems": 2,
                                          "maxItems": 20
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "components"
                                      ]
                                    }
                                  ]
                                },
                                "currencyTerm": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "reductions": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "basisPoints": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "fromTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "untilTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "rounding": {
                                        "enum": [
                                          "half_up",
                                          "floor"
                                        ]
                                      },
                                      "appliesTo": {
                                        "enum": [
                                          "recurring"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "fromTerm"
                                    ]
                                  },
                                  "minItems": 1,
                                  "maxItems": 4
                                }
                              },
                              "required": [
                                "treatment",
                                "calculation",
                                "currencyTerm"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "treatment": {
                                  "enum": [
                                    "included",
                                    "free",
                                    "promotional"
                                  ]
                                },
                                "evidence": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "kind": {
                                        "enum": [
                                          "tap_message",
                                          "x402_receipt",
                                          "chain_tx",
                                          "signed_doc",
                                          "stripe_object",
                                          "other"
                                        ]
                                      },
                                      "ref": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "signer": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "ref"
                                    ]
                                  },
                                  "minItems": 1,
                                  "maxItems": 20
                                }
                              },
                              "required": [
                                "treatment",
                                "evidence"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "treatment": {
                                  "const": "unknown"
                                },
                                "evidence": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "kind": {
                                        "enum": [
                                          "tap_message",
                                          "x402_receipt",
                                          "chain_tx",
                                          "signed_doc",
                                          "stripe_object",
                                          "other"
                                        ]
                                      },
                                      "ref": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "signer": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "ref"
                                    ]
                                  },
                                  "minItems": 1,
                                  "maxItems": 20
                                },
                                "knownAmountTerm": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "treatment",
                                "evidence"
                              ]
                            }
                          ]
                        },
                        "recurringValue": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "interval": {
                              "enum": [
                                "monthly",
                                "yearly"
                              ]
                            },
                            "startTerm": {
                              "type": "string",
                              "minLength": 1
                            },
                            "endTerm": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "interval",
                            "startTerm"
                          ]
                        },
                        "usage": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "quantityFact": {
                              "type": "string",
                              "minLength": 1
                            },
                            "schedule": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "startTerm": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "anchorTerm": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "endTerm": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "everyMonths": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "timing": {
                                  "enum": [
                                    "start",
                                    "end"
                                  ]
                                },
                                "offsetDays": {
                                  "type": "integer",
                                  "minimum": -365,
                                  "maximum": 365
                                },
                                "serviceEvidence": {
                                  "const": "elapsed_time"
                                }
                              },
                              "required": [
                                "startTerm",
                                "everyMonths",
                                "timing",
                                "offsetDays"
                              ]
                            },
                            "estimate": {
                              "enum": [
                                "priced",
                                "observed_amount",
                                "none"
                              ]
                            },
                            "amountDecimals": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9
                            },
                            "allocation": {
                              "enum": [
                                "estimate",
                                "quantity"
                              ]
                            },
                            "customerFunction": {
                              "enum": [
                                "cost_of_revenue",
                                "research_and_development",
                                "sales_and_marketing",
                                "general_and_administrative",
                                "other"
                              ]
                            },
                            "roundingTolerance": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            }
                          },
                          "required": [
                            "quantityFact",
                            "schedule",
                            "estimate",
                            "allocation"
                          ]
                        },
                        "lot": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "origin": {
                              "enum": [
                                "bought",
                                "granted"
                              ]
                            },
                            "ledger": {
                              "type": "string",
                              "minLength": 1
                            },
                            "face": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            },
                            "expiresAt": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            },
                            "effectiveAt": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            },
                            "coverageBps": {
                              "type": "string",
                              "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                            },
                            "taxPosition": {
                              "enum": [
                                "reduces_tax_base",
                                "excludes_tax",
                                "includes_tax"
                              ]
                            },
                            "refundOnClose": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "origin",
                            "ledger",
                            "face",
                            "taxPosition",
                            "refundOnClose"
                          ]
                        },
                        "economics": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "quantity": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "term": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "minimum": {
                                  "type": "string",
                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                },
                                "periodQuantity": {
                                  "enum": [
                                    "at_start",
                                    "at_end",
                                    "maximum",
                                    "time_weighted"
                                  ]
                                },
                                "proration": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "basis": {
                                      "enum": [
                                        "actual_days",
                                        "elapsed",
                                        "days_365",
                                        "days_30",
                                        "true_up_windows",
                                        "stated",
                                        "none"
                                      ]
                                    },
                                    "rounding": {
                                      "enum": [
                                        "half_up",
                                        "down",
                                        "up"
                                      ]
                                    },
                                    "per": {
                                      "enum": [
                                        "change",
                                        "unit"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "basis",
                                    "rounding",
                                    "per"
                                  ]
                                },
                                "increase": {
                                  "enum": [
                                    "now",
                                    "next_period"
                                  ]
                                },
                                "decrease": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "credit_now"
                                        },
                                        "credit": {
                                          "enum": [
                                            "refund",
                                            "vendor_credit"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "credit"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "enum": [
                                            "no_credit",
                                            "next_period",
                                            "at_renewal"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "within_days"
                                        },
                                        "days": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 31
                                        },
                                        "credit": {
                                          "enum": [
                                            "refund",
                                            "vendor_credit"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "days",
                                        "credit"
                                      ]
                                    }
                                  ]
                                },
                                "billedOn": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "on": {
                                          "enum": [
                                            "change",
                                            "next_bill"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "on"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "on": {
                                          "const": "true_up"
                                        },
                                        "everyMonths": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 120
                                        },
                                        "anchor": {
                                          "enum": [
                                            "billing",
                                            "calendar"
                                          ]
                                        },
                                        "measure": {
                                          "enum": [
                                            "changes",
                                            "maximum"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "on",
                                        "everyMonths",
                                        "anchor",
                                        "measure"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "term",
                                "periodQuantity",
                                "proration",
                                "increase",
                                "decrease",
                                "billedOn"
                              ]
                            },
                            "kind": {
                              "enum": [
                                "service",
                                "capacity",
                                "ownership",
                                "financing",
                                "distribution"
                              ]
                            },
                            "direction": {
                              "enum": [
                                "provide",
                                "receive"
                              ]
                            },
                            "safe": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "valuationBasis": {
                                      "enum": [
                                        "post_money",
                                        "pre_money"
                                      ]
                                    },
                                    "capTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "discountPpmTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "valuationBasis",
                                    "capTerm"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "valuationBasis": {
                                      "enum": [
                                        "post_money",
                                        "pre_money"
                                      ]
                                    },
                                    "discountPpmTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": []
                                }
                              ]
                            },
                            "billing": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "timing": {
                                  "enum": [
                                    "advance",
                                    "arrears",
                                    "upfront"
                                  ]
                                },
                                "schedule": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "startTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "anchorTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "endTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    },
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 366
                                    },
                                    "timing": {
                                      "enum": [
                                        "start",
                                        "end"
                                      ]
                                    },
                                    "offsetDays": {
                                      "type": "integer",
                                      "minimum": -365,
                                      "maximum": 365
                                    },
                                    "serviceEvidence": {
                                      "const": "elapsed_time"
                                    }
                                  },
                                  "required": [
                                    "startTerm",
                                    "timing",
                                    "offsetDays"
                                  ],
                                  "oneOf": [
                                    {
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                },
                                "on": {
                                  "enum": [
                                    "accept",
                                    "cancel",
                                    "terminate"
                                  ]
                                },
                                "automatic": {
                                  "type": "boolean"
                                },
                                "dueDays": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 365
                                },
                                "factsDueDays": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 90
                                },
                                "factsFrom": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                }
                              },
                              "required": [
                                "timing"
                              ]
                            },
                            "recognition": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "timing": {
                                  "enum": [
                                    "delivery",
                                    "usage",
                                    "ratable"
                                  ]
                                },
                                "allocation": {
                                  "enum": [
                                    "equal_periods"
                                  ]
                                },
                                "schedule": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "startTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "anchorTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "endTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    },
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 366
                                    },
                                    "timing": {
                                      "enum": [
                                        "start",
                                        "end"
                                      ]
                                    },
                                    "offsetDays": {
                                      "type": "integer",
                                      "minimum": -365,
                                      "maximum": 365
                                    },
                                    "serviceEvidence": {
                                      "const": "elapsed_time"
                                    }
                                  },
                                  "required": [
                                    "startTerm",
                                    "timing",
                                    "offsetDays"
                                  ],
                                  "oneOf": [
                                    {
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                },
                                "on": {
                                  "enum": [
                                    "accept",
                                    "cancel",
                                    "terminate"
                                  ]
                                }
                              },
                              "required": [
                                "timing"
                              ]
                            },
                            "consideration": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "money"
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                    },
                                    "currencyTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "recognition": {
                                      "enum": [
                                        "unconditional_obligation",
                                        "condition_satisfied"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "amount",
                                    "currencyTerm",
                                    "recognition"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "units"
                                    },
                                    "quantity": {
                                      "type": "string",
                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                    },
                                    "ledger": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "quantity",
                                    "ledger"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "claim"
                                    },
                                    "claimFact": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                    },
                                    "currencyTerm": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "claimFact",
                                    "amount",
                                    "currencyTerm"
                                  ]
                                }
                              ]
                            },
                            "classification": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "monetaryLedger": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "capitalAccount": {
                                  "enum": [
                                    3100,
                                    3110,
                                    3120
                                  ]
                                },
                                "revenueCategory": {
                                  "enum": [
                                    "services",
                                    "subscription",
                                    "consulting",
                                    "usage",
                                    "grant"
                                  ]
                                },
                                "expenseAccount": {
                                  "type": "integer"
                                },
                                "expenseFunction": {
                                  "enum": [
                                    "cost_of_revenue",
                                    "research_and_development",
                                    "sales_and_marketing",
                                    "general_and_administrative",
                                    "other"
                                  ]
                                },
                                "product": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "taxCode": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "taxTreatment": {
                                  "enum": [
                                    "inclusive",
                                    "exclusive"
                                  ]
                                }
                              },
                              "required": [
                                "monetaryLedger"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "direction"
                          ]
                        }
                      },
                      "required": [
                        "model",
                        "name",
                        "price",
                        "economics"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "expectedDocumentId",
                    "definition"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind activity, template, contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.change_fiscal_year"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "yearEnd",
                    "reason"
                  ],
                  "properties": {
                    "yearEnd": {
                      "type": "string",
                      "pattern": "^(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$",
                      "description": "Fiscal year end as MM-DD, e.g. 12-31, 03-31, 06-30. 02-29 is refused; use 02-28."
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.change_functional_currency"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "fromCurrency",
                    "toCurrency",
                    "reason"
                  ],
                  "properties": {
                    "fromCurrency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "toCurrency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.change_legal_form"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "reason"
                  ],
                  "properties": {
                    "jurisdiction": {
                      "enum": [
                        "US",
                        "US-AL",
                        "US-AK",
                        "US-AZ",
                        "US-AR",
                        "US-CA",
                        "US-CO",
                        "US-CT",
                        "US-DE",
                        "US-DC",
                        "US-FL",
                        "US-GA",
                        "US-HI",
                        "US-ID",
                        "US-IL",
                        "US-IN",
                        "US-IA",
                        "US-KS",
                        "US-KY",
                        "US-LA",
                        "US-ME",
                        "US-MD",
                        "US-MA",
                        "US-MI",
                        "US-MN",
                        "US-MS",
                        "US-MO",
                        "US-MT",
                        "US-NE",
                        "US-NV",
                        "US-NH",
                        "US-NJ",
                        "US-NM",
                        "US-NY",
                        "US-NC",
                        "US-ND",
                        "US-OH",
                        "US-OK",
                        "US-OR",
                        "US-PA",
                        "US-RI",
                        "US-SC",
                        "US-SD",
                        "US-TN",
                        "US-TX",
                        "US-UT",
                        "US-VT",
                        "US-VA",
                        "US-WA",
                        "US-WV",
                        "US-WI",
                        "US-WY",
                        "SG",
                        "CA",
                        "CA-AB",
                        "CA-BC",
                        "CA-MB",
                        "CA-NB",
                        "CA-NL",
                        "CA-NS",
                        "CA-NT",
                        "CA-NU",
                        "CA-ON",
                        "CA-PE",
                        "CA-QC",
                        "CA-SK",
                        "CA-YT",
                        "GB",
                        "GB-EAW",
                        "GB-SCT",
                        "GB-NIR",
                        "CH",
                        "AT",
                        "BE",
                        "BG",
                        "HR",
                        "CY",
                        "CZ",
                        "DK",
                        "EE",
                        "FI",
                        "FR",
                        "DE",
                        "GR",
                        "HU",
                        "IE",
                        "IT",
                        "LV",
                        "LT",
                        "LU",
                        "MT",
                        "NL",
                        "PL",
                        "PT",
                        "RO",
                        "SK",
                        "SI",
                        "ES",
                        "SE"
                      ],
                      "description": "Country of incorporation (ISO 3166-1), or the ISO 3166-2 subdivision holding the register: US-DE, SG, CA (federal) or CA-ON, GB-EAW/GB-SCT/GB-NIR, CH."
                    },
                    "legalEntityType": {
                      "enum": [
                        "unknown",
                        "llc",
                        "c_corp",
                        "s_corp",
                        "sole_proprietorship",
                        "partnership",
                        "nonprofit",
                        "unincorporated",
                        "other",
                        "private_limited_company",
                        "corporation",
                        "stock_corporation",
                        "project"
                      ]
                    },
                    "reason": {
                      "type": "string",
                      "pattern": ".*\\S.*",
                      "maxLength": 2000
                    }
                  },
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "jurisdiction": {
                          "enum": [
                            "US",
                            "US-AL",
                            "US-AK",
                            "US-AZ",
                            "US-AR",
                            "US-CA",
                            "US-CO",
                            "US-CT",
                            "US-DE",
                            "US-DC",
                            "US-FL",
                            "US-GA",
                            "US-HI",
                            "US-ID",
                            "US-IL",
                            "US-IN",
                            "US-IA",
                            "US-KS",
                            "US-KY",
                            "US-LA",
                            "US-ME",
                            "US-MD",
                            "US-MA",
                            "US-MI",
                            "US-MN",
                            "US-MS",
                            "US-MO",
                            "US-MT",
                            "US-NE",
                            "US-NV",
                            "US-NH",
                            "US-NJ",
                            "US-NM",
                            "US-NY",
                            "US-NC",
                            "US-ND",
                            "US-OH",
                            "US-OK",
                            "US-OR",
                            "US-PA",
                            "US-RI",
                            "US-SC",
                            "US-SD",
                            "US-TN",
                            "US-TX",
                            "US-UT",
                            "US-VT",
                            "US-VA",
                            "US-WA",
                            "US-WV",
                            "US-WI",
                            "US-WY",
                            "SG",
                            "CA",
                            "CA-AB",
                            "CA-BC",
                            "CA-MB",
                            "CA-NB",
                            "CA-NL",
                            "CA-NS",
                            "CA-NT",
                            "CA-NU",
                            "CA-ON",
                            "CA-PE",
                            "CA-QC",
                            "CA-SK",
                            "CA-YT",
                            "GB",
                            "GB-EAW",
                            "GB-SCT",
                            "GB-NIR",
                            "CH",
                            "AT",
                            "BE",
                            "BG",
                            "HR",
                            "CY",
                            "CZ",
                            "DK",
                            "EE",
                            "FI",
                            "FR",
                            "DE",
                            "GR",
                            "HU",
                            "IE",
                            "IT",
                            "LV",
                            "LT",
                            "LU",
                            "MT",
                            "NL",
                            "PL",
                            "PT",
                            "RO",
                            "SK",
                            "SI",
                            "ES",
                            "SE"
                          ],
                          "description": "Country of incorporation (ISO 3166-1), or the ISO 3166-2 subdivision holding the register: US-DE, SG, CA (federal) or CA-ON, GB-EAW/GB-SCT/GB-NIR, CH."
                        }
                      },
                      "required": [
                        "jurisdiction"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "legalEntityType": {
                          "enum": [
                            "unknown",
                            "llc",
                            "c_corp",
                            "s_corp",
                            "sole_proprietorship",
                            "partnership",
                            "nonprofit",
                            "unincorporated",
                            "other",
                            "private_limited_company",
                            "corporation",
                            "stock_corporation",
                            "project"
                          ]
                        }
                      },
                      "required": [
                        "legalEntityType"
                      ]
                    }
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.change_legal_name"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "name",
                    "reason"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$",
                      "maxLength": 500
                    },
                    "reason": {
                      "type": "string",
                      "pattern": ".*\\S.*",
                      "maxLength": 2000
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.deregister_sales_tax"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "regime",
                    "effectiveUntil",
                    "reason"
                  ],
                  "properties": {
                    "regime": {
                      "enum": [
                        "sg_gst",
                        "ca_gst_hst",
                        "ca_qst",
                        "ca_pst_bc",
                        "ca_pst_sk",
                        "ca_rst_mb",
                        "gb_vat"
                      ],
                      "description": "sg_gst (Singapore GST); ca_gst_hst (Canadian GST/HST), ca_qst (Quebec QST), ca_pst_bc, ca_pst_sk, ca_rst_mb (provincial sales taxes, kept apart from GST/HST); gb_vat (UK VAT). It must be a regime of the country the business is incorporated in. There is no US regime: record US state sales tax as custom codes with tax_codes.create."
                    },
                    "effectiveUntil": {
                      "type": "string",
                      "format": "date",
                      "description": "First day the business is no longer registered; after the registration began and no later than today."
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.elect_accounting_framework"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "framework",
                    "reason"
                  ],
                  "properties": {
                    "framework": {
                      "enum": [
                        "us_gaap",
                        "sg_frs",
                        "sg_sfrs_small_entities",
                        "sg_sfrs_i",
                        "ca_aspe",
                        "ca_ifrs",
                        "uk_frs_102",
                        "uk_frs_102_section_1a",
                        "uk_frs_105",
                        "ch_co"
                      ],
                      "description": "US us_gaap; SG sg_frs, sg_sfrs_small_entities, sg_sfrs_i; CA ca_aspe, ca_ifrs; GB uk_frs_102, uk_frs_102_section_1a, uk_frs_105; CH ch_co. Must belong to the business's country. Swiss GAAP FER is not supported."
                    },
                    "edition": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    },
                    "sizeRegime": {
                      "enum": [
                        "small",
                        "micro"
                      ],
                      "description": "Optional; implied by the framework (small: sg_sfrs_small_entities, uk_frs_102_section_1a; micro: uk_frs_105)."
                    },
                    "sizeEligibility": {
                      "type": "object",
                      "required": [
                        "basis",
                        "periodEnd"
                      ],
                      "properties": {
                        "basis": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000,
                          "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                        },
                        "periodEnd": {
                          "type": "string",
                          "format": "date",
                          "description": "Period end the conclusion covers."
                        }
                      }
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.incorporate"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "legalEntityType",
                    "reason"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500,
                      "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$",
                      "description": "The company's legal name. Omitted, the project's public name becomes it; a public name that differed from the project's legal name is kept."
                    },
                    "legalEntityType": {
                      "enum": [
                        "llc",
                        "c_corp",
                        "s_corp",
                        "private_limited_company",
                        "corporation",
                        "stock_corporation"
                      ],
                      "description": "The incorporated form; it must exist in the jurisdiction."
                    },
                    "jurisdiction": {
                      "enum": [
                        "US",
                        "US-AL",
                        "US-AK",
                        "US-AZ",
                        "US-AR",
                        "US-CA",
                        "US-CO",
                        "US-CT",
                        "US-DE",
                        "US-DC",
                        "US-FL",
                        "US-GA",
                        "US-HI",
                        "US-ID",
                        "US-IL",
                        "US-IN",
                        "US-IA",
                        "US-KS",
                        "US-KY",
                        "US-LA",
                        "US-ME",
                        "US-MD",
                        "US-MA",
                        "US-MI",
                        "US-MN",
                        "US-MS",
                        "US-MO",
                        "US-MT",
                        "US-NE",
                        "US-NV",
                        "US-NH",
                        "US-NJ",
                        "US-NM",
                        "US-NY",
                        "US-NC",
                        "US-ND",
                        "US-OH",
                        "US-OK",
                        "US-OR",
                        "US-PA",
                        "US-RI",
                        "US-SC",
                        "US-SD",
                        "US-TN",
                        "US-TX",
                        "US-UT",
                        "US-VT",
                        "US-VA",
                        "US-WA",
                        "US-WV",
                        "US-WI",
                        "US-WY",
                        "SG",
                        "CA",
                        "CA-AB",
                        "CA-BC",
                        "CA-MB",
                        "CA-NB",
                        "CA-NL",
                        "CA-NS",
                        "CA-NT",
                        "CA-NU",
                        "CA-ON",
                        "CA-PE",
                        "CA-QC",
                        "CA-SK",
                        "CA-YT",
                        "GB",
                        "GB-EAW",
                        "GB-SCT",
                        "GB-NIR",
                        "CH",
                        "AT",
                        "BE",
                        "BG",
                        "HR",
                        "CY",
                        "CZ",
                        "DK",
                        "EE",
                        "FI",
                        "FR",
                        "DE",
                        "GR",
                        "HU",
                        "IE",
                        "IT",
                        "LV",
                        "LT",
                        "LU",
                        "MT",
                        "NL",
                        "PL",
                        "PT",
                        "RO",
                        "SK",
                        "SI",
                        "ES",
                        "SE"
                      ],
                      "description": "Where the company is incorporated. Omitted, the project's jurisdiction. In another country, the facts that held only in the project's country are cleared."
                    },
                    "ownerPartyId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The founder who receives the shares: the one party holding the project's capital. Needed only when no party holds it; naming anyone else is refused, and so is a project whose capital more than one party holds (move it to the founder first)."
                    },
                    "parValue": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$",
                      "maxLength": 38,
                      "description": "Minor units of the contributed net assets booked to share capital at par (3100); the rest is paid-in capital (3110), negative for a project that owes more than it owns. The net assets must cover a nonzero par value. Default 0."
                    },
                    "reason": {
                      "type": "string",
                      "pattern": ".*\\S.*",
                      "maxLength": 2000
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.record_formation_date"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "date",
                    "reason"
                  ],
                  "properties": {
                    "date": {
                      "type": "string",
                      "format": "date"
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.register_sales_tax"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "regime",
                    "registrationNumber",
                    "effectiveFrom",
                    "reason"
                  ],
                  "properties": {
                    "regime": {
                      "enum": [
                        "sg_gst",
                        "ca_gst_hst",
                        "ca_qst",
                        "ca_pst_bc",
                        "ca_pst_sk",
                        "ca_rst_mb",
                        "gb_vat"
                      ],
                      "description": "sg_gst (Singapore GST); ca_gst_hst (Canadian GST/HST), ca_qst (Quebec QST), ca_pst_bc, ca_pst_sk, ca_rst_mb (provincial sales taxes, kept apart from GST/HST); gb_vat (UK VAT). It must be a regime of the country the business is incorporated in. There is no US regime: record US state sales tax as custom codes with tax_codes.create."
                    },
                    "registrationNumber": {
                      "type": "string",
                      "minLength": 1,
                      "description": "As issued: a Singapore UEN or IRAS GST number (201912345K, M2-1234567-K); a Canadian BN with its RT account (123456789RT0001); a QST number (1234567890TQ0001); PST-1234-5678 (BC); a UK VAT number (GB123456789). Spaces are ignored."
                    },
                    "province": {
                      "type": "string",
                      "pattern": "^CA-[A-Z]{2}$",
                      "description": "Required for ca_gst_hst: the province the registrant operates from, e.g. CA-ON. Not accepted for other regimes."
                    },
                    "effectiveFrom": {
                      "type": "string",
                      "format": "date",
                      "description": "The effective date of registration the authority confirmed."
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.set_registration"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "kind",
                    "number",
                    "reason"
                  ],
                  "properties": {
                    "kind": {
                      "enum": [
                        "us_ein",
                        "sg_uen",
                        "ca_bn",
                        "gb_company_number"
                      ]
                    },
                    "number": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 32
                    },
                    "reason": {
                      "type": "string",
                      "pattern": ".*\\S.*",
                      "maxLength": 2000
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "business.update"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500,
                      "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$",
                      "description": "The public name the workspace and shared pages show. The legal name changes with business.change_legal_name."
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 280,
                      "pattern": "^[^\\r\\n]*$"
                    },
                    "address": {
                      "type": "object",
                      "properties": {
                        "line1": {
                          "type": "string",
                          "maxLength": 200,
                          "pattern": "^[^\\r\\n]+$"
                        },
                        "line2": {
                          "type": "string",
                          "maxLength": 200,
                          "pattern": "^[^\\r\\n]*$"
                        },
                        "city": {
                          "type": "string",
                          "maxLength": 200,
                          "pattern": "^[^\\r\\n]+$"
                        },
                        "region": {
                          "type": "string",
                          "maxLength": 200,
                          "pattern": "^[^\\r\\n]*$"
                        },
                        "postalCode": {
                          "type": "string",
                          "maxLength": 40,
                          "pattern": "^[^\\r\\n]*$"
                        },
                        "country": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        }
                      },
                      "required": [
                        "line1",
                        "city",
                        "country"
                      ],
                      "additionalProperties": false
                    },
                    "url": {
                      "type": "string",
                      "pattern": "^https?://[^\\s/]+",
                      "maxLength": 2048
                    },
                    "logoUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "A logo in Economico's shared public images, as the canonical https://logos.economi.co/logos/{owner-id}/{cid}.{png|jpg|webp} link an upload returns. The form is checked, not looked up: any link in that form is accepted, and any other link is refused. Anyone with the link can view the image; after replacing an image, set its new link here. Shown on the business's share pages. Omit it to keep the current logo; null clears it."
                    },
                    "ycVerificationUrl": {
                      "type": "string",
                      "pattern": "^https://(?:www\\.)?ycombinator\\.com/verify/[A-Za-z0-9]+/?$"
                    }
                  },
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500,
                          "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$",
                          "description": "The public name the workspace and shared pages show. The legal name changes with business.change_legal_name."
                        }
                      },
                      "required": [
                        "name"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string",
                          "maxLength": 280,
                          "pattern": "^[^\\r\\n]*$"
                        }
                      },
                      "required": [
                        "description"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "address": {
                          "type": "object",
                          "properties": {
                            "line1": {
                              "type": "string",
                              "maxLength": 200,
                              "pattern": "^[^\\r\\n]+$"
                            },
                            "line2": {
                              "type": "string",
                              "maxLength": 200,
                              "pattern": "^[^\\r\\n]*$"
                            },
                            "city": {
                              "type": "string",
                              "maxLength": 200,
                              "pattern": "^[^\\r\\n]+$"
                            },
                            "region": {
                              "type": "string",
                              "maxLength": 200,
                              "pattern": "^[^\\r\\n]*$"
                            },
                            "postalCode": {
                              "type": "string",
                              "maxLength": 40,
                              "pattern": "^[^\\r\\n]*$"
                            },
                            "country": {
                              "type": "string",
                              "pattern": "^[A-Z]{2}$"
                            }
                          },
                          "required": [
                            "line1",
                            "city",
                            "country"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "address"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "pattern": "^https?://[^\\s/]+",
                          "maxLength": 2048
                        }
                      },
                      "required": [
                        "url"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "logoUrl": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "A logo in Economico's shared public images, as the canonical https://logos.economi.co/logos/{owner-id}/{cid}.{png|jpg|webp} link an upload returns. The form is checked, not looked up: any link in that form is accepted, and any other link is refused. Anyone with the link can view the image; after replacing an image, set its new link here. Shown on the business's share pages. Omit it to keep the current logo; null clears it."
                        }
                      },
                      "required": [
                        "logoUrl"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "ycVerificationUrl": {
                          "type": "string",
                          "pattern": "^https://(?:www\\.)?ycombinator\\.com/verify/[A-Za-z0-9]+/?$"
                        }
                      },
                      "required": [
                        "ycVerificationUrl"
                      ]
                    }
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "card_statements.pay"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "statementId",
                    "financialAccountId",
                    "amount",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "statementId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "amount": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]*$"
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "card_statements.record"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "financialAccountId",
                    "contractId",
                    "closingDate",
                    "dueDate",
                    "statementBalance",
                    "minimumDue",
                    "documentId",
                    "sourceFactId"
                  ],
                  "properties": {
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "closingDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "dueDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "statementBalance": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "minimumDue": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "interest": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "fees": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "documentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "card_statements.reverse_payment"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "paymentId",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "paymentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "card_statements.void"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "statementId",
                    "reason",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "statementId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "categories.create"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "categoryId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "code": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "categoryId",
                    "name",
                    "code"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "concessions.assign"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "offerId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "email": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 320
                    }
                  },
                  "required": [
                    "offerId",
                    "email"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "concessions.create_offer"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "purpose": {
                      "enum": [
                        "acquisition",
                        "retention",
                        "service",
                        "research"
                      ]
                    },
                    "campaign": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "partnerPartyId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "partnerContractId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "discount": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "basisPoints": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "amount": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "months": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1200
                        }
                      },
                      "required": []
                    },
                    "maxRedemptions": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000000
                    },
                    "emails": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 320
                      },
                      "maxItems": 50
                    },
                    "code": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 40
                    },
                    "system": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 40
                    },
                    "validFrom": {
                      "type": "string",
                      "format": "date"
                    },
                    "validUntil": {
                      "type": "string",
                      "format": "date"
                    },
                    "eligibility": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "emailDomain": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "name",
                    "purpose",
                    "discount"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "concessions.reassign"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "offerId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "from": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 320
                    },
                    "to": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 320
                    }
                  },
                  "required": [
                    "offerId",
                    "from",
                    "to"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "concessions.record_given"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "offerId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "code": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "contractId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "email": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 320
                    },
                    "reservationKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "contractId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "concessions.reserve"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "offerId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "code": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "email": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 320
                    },
                    "reservationKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "reservationKey"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "concessions.retire"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "offerId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "offerId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "connections.accept"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "connectionId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "connectionId",
                    "partyId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "connections.decline"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "connectionId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "connectionId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "connections.end"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "connectionId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "connectionId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "connections.request"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "to": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 63,
                      "description": "The other business's exact slug."
                    },
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "note": {
                      "type": "string",
                      "maxLength": 500
                    }
                  },
                  "required": [
                    "to",
                    "partyId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.accept"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "expectedStatus",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedStatus": {
                      "enum": [
                        "draft",
                        "offer",
                        "active",
                        "rejected",
                        "terminated",
                        "expired"
                      ]
                    },
                    "effectiveAt": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "facts": {
                      "type": "object",
                      "maxProperties": 100
                    },
                    "exchangeRate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "base",
                        "quote",
                        "date",
                        "numerator",
                        "denominator",
                        "evidence"
                      ],
                      "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                      "properties": {
                        "base": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "quote": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "numerator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "denominator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "acceptance"
                      ],
                      "properties": {
                        "acceptance": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "economic": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "service": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.add_granted_credit"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "effectiveAt",
                    "key",
                    "name",
                    "eligibleRights",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "minLength": 1,
                      "format": "date-time"
                    },
                    "key": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "eligibleRights": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "minItems": 1,
                      "maxItems": 100
                    },
                    "coverageBps": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]{0,4}$"
                    },
                    "sourceDocumentIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 100
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.add_usage_meter"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "effectiveAt",
                    "key",
                    "name",
                    "unit",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "minLength": 1,
                      "format": "date-time"
                    },
                    "key": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "unit": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "sourceDocumentIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 100
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.adopt"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "vendorPlan": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "cid": {
                          "type": "string",
                          "minLength": 1
                        },
                        "template": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "cid",
                        "template"
                      ]
                    },
                    "vendor": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "partyId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "create": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "partyId": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "partyId"
                          ]
                        }
                      },
                      "required": []
                    },
                    "billingCountry": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "country": {
                          "type": "string",
                          "minLength": 1
                        },
                        "state": {
                          "type": "string",
                          "minLength": 1
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "kind": {
                                "type": "string",
                                "minLength": 1
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "kind",
                              "ref"
                            ]
                          }
                        }
                      },
                      "required": [
                        "country",
                        "evidence"
                      ]
                    },
                    "buyerTax": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "registered": {
                          "type": "boolean"
                        },
                        "registrationProvided": {
                          "type": "boolean"
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "kind": {
                                "type": "string",
                                "minLength": 1
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "kind",
                              "ref"
                            ]
                          }
                        }
                      },
                      "required": [
                        "registered",
                        "evidence"
                      ]
                    },
                    "seller": {
                      "type": "string",
                      "minLength": 1
                    },
                    "terms": {
                      "type": "object",
                      "maxProperties": 100,
                      "additionalProperties": {
                        "type": "object",
                        "maxProperties": 100,
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "classification": {
                      "type": "object",
                      "maxProperties": 100,
                      "additionalProperties": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "expenseAccount": {
                            "type": "integer"
                          },
                          "expenseFunction": {
                            "type": "string"
                          },
                          "taxCode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "taxTreatment": {
                            "enum": [
                              "exclusive",
                              "inclusive",
                              null
                            ]
                          }
                        }
                      }
                    },
                    "ledgerBindings": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "sourceDocumentIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 100
                    },
                    "lifecycleBinding": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "startsOn": {
                          "type": "string",
                          "minLength": 1,
                          "format": "date"
                        },
                        "endsOn": {
                          "type": "string",
                          "minLength": 1,
                          "format": "date"
                        }
                      },
                      "required": [
                        "startsOn"
                      ]
                    },
                    "lifecycle": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "term": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "index": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "startsOn": {
                              "type": "string",
                              "minLength": 1,
                              "format": "date",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "endsOn": {
                              "type": "string",
                              "minLength": 1,
                              "format": "date",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "rolling": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    }
                                  },
                                  "required": [
                                    "everyMonths"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3660
                                    }
                                  },
                                  "required": [
                                    "everyDays"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "index",
                            "startsOn"
                          ]
                        },
                        "atTermEnd": {
                          "enum": [
                            "renew",
                            "evergreen",
                            "end",
                            "renew_once"
                          ]
                        },
                        "renewal": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "length": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    }
                                  },
                                  "required": [
                                    "everyMonths"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3660
                                    }
                                  },
                                  "required": [
                                    "everyDays"
                                  ]
                                }
                              ]
                            },
                            "price": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "enum": [
                                        "same",
                                        "list"
                                      ]
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "uplift"
                                    },
                                    "bps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000
                                    },
                                    "terms": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "right": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "term": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "right",
                                          "term"
                                        ]
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "bps",
                                    "terms"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "capped"
                                    },
                                    "bps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000
                                    },
                                    "terms": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "right": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "term": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "right",
                                          "term"
                                        ]
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    },
                                    "index": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "uncappedWhen": {
                                      "type": "array",
                                      "items": {
                                        "enum": [
                                          "quantity_reduced",
                                          "term_shortened"
                                        ]
                                      },
                                      "maxItems": 2,
                                      "minItems": 0
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "bps",
                                    "terms"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "price"
                          ]
                        },
                        "notice": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "days": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 366
                            },
                            "basis": {
                              "enum": [
                                "calendar",
                                "weekdays"
                              ]
                            },
                            "remindDaysBefore": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 366
                            }
                          },
                          "required": [
                            "days",
                            "basis"
                          ]
                        },
                        "cancellation": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "windows": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "from": {
                                    "enum": [
                                      "term_start",
                                      "term_end"
                                    ]
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 366
                                  }
                                },
                                "required": [
                                  "from",
                                  "days"
                                ]
                              },
                              "maxItems": 20,
                              "minItems": 0
                            },
                            "onlyInWindows": {
                              "const": true
                            },
                            "otherwise": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "none"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "fee"
                                    },
                                    "right": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "right"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "accelerate"
                                    },
                                    "rights": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "rights"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "windows",
                            "otherwise"
                          ]
                        }
                      },
                      "required": [
                        "term",
                        "atTermEnd",
                        "notice"
                      ]
                    },
                    "acceptance": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "sourceFactId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "evidence": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "acceptance": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "kind",
                                  "ref"
                                ]
                              }
                            },
                            "economic": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "kind",
                                  "ref"
                                ]
                              }
                            },
                            "service": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "kind",
                                  "ref"
                                ]
                              }
                            }
                          },
                          "required": [
                            "acceptance"
                          ]
                        },
                        "facts": {
                          "type": "object"
                        }
                      },
                      "required": [
                        "sourceFactId",
                        "evidence"
                      ]
                    },
                    "replaces": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 100,
                      "uniqueItems": true
                    },
                    "retireCredit": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "vendorPlan",
                    "vendor"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document, contract, template, vendor_plan that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.amend"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "effectiveAt",
                    "acceptanceEvidence"
                  ],
                  "properties": {
                    "lifecycle": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "term": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "index": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "startsOn": {
                              "type": "string",
                              "minLength": 1,
                              "format": "date",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "endsOn": {
                              "type": "string",
                              "minLength": 1,
                              "format": "date",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "rolling": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    }
                                  },
                                  "required": [
                                    "everyMonths"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3660
                                    }
                                  },
                                  "required": [
                                    "everyDays"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "index",
                            "startsOn"
                          ]
                        },
                        "atTermEnd": {
                          "enum": [
                            "renew",
                            "evergreen",
                            "end",
                            "renew_once"
                          ]
                        },
                        "renewal": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "length": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    }
                                  },
                                  "required": [
                                    "everyMonths"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3660
                                    }
                                  },
                                  "required": [
                                    "everyDays"
                                  ]
                                }
                              ]
                            },
                            "price": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "enum": [
                                        "same",
                                        "list"
                                      ]
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "uplift"
                                    },
                                    "bps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000
                                    },
                                    "terms": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "right": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "term": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "right",
                                          "term"
                                        ]
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "bps",
                                    "terms"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "capped"
                                    },
                                    "bps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000
                                    },
                                    "terms": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "right": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "term": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "right",
                                          "term"
                                        ]
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    },
                                    "index": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "uncappedWhen": {
                                      "type": "array",
                                      "items": {
                                        "enum": [
                                          "quantity_reduced",
                                          "term_shortened"
                                        ]
                                      },
                                      "maxItems": 2,
                                      "minItems": 0
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "bps",
                                    "terms"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "price"
                          ]
                        },
                        "notice": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "days": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 366
                            },
                            "basis": {
                              "enum": [
                                "calendar",
                                "weekdays"
                              ]
                            },
                            "remindDaysBefore": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 366
                            }
                          },
                          "required": [
                            "days",
                            "basis"
                          ]
                        },
                        "cancellation": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "windows": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "from": {
                                    "enum": [
                                      "term_start",
                                      "term_end"
                                    ]
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 366
                                  }
                                },
                                "required": [
                                  "from",
                                  "days"
                                ]
                              },
                              "maxItems": 20,
                              "minItems": 0
                            },
                            "onlyInWindows": {
                              "const": true
                            },
                            "otherwise": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "none"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "fee"
                                    },
                                    "right": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "right"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "accelerate"
                                    },
                                    "rights": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "rights"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "windows",
                            "otherwise"
                          ]
                        },
                        "changes": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "termsChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "on_posting"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "next_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "locked_to_order"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "objection_until_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            },
                            "priceChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "no_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "held_for_paid_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "capped_at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "capPpm": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000000
                                    },
                                    "index": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "capPpm"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "mid_term_credit"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": []
                        }
                      },
                      "required": [
                        "atTermEnd",
                        "notice"
                      ]
                    },
                    "agreements": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "changes": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "termsChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "on_posting"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "next_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "locked_to_order"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "objection_until_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            },
                            "priceChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "no_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "held_for_paid_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "capped_at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "capPpm": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000000
                                    },
                                    "index": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "capPpm"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "mid_term_credit"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": []
                        },
                        "refs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "role": {
                                "enum": [
                                  "agreement",
                                  "order_form",
                                  "schedule",
                                  "policy"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1,
                                "format": "uri",
                                "maxLength": 2048
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              },
                              "method": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "pdf",
                                      "markdown",
                                      "html",
                                      "html_blanked",
                                      "html_extract",
                                      "embedded_json",
                                      "api_json",
                                      "text_render",
                                      "unstable"
                                    ]
                                  },
                                  "command": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  }
                                },
                                "required": [
                                  "kind"
                                ]
                              },
                              "seenAt": {
                                "type": "string",
                                "minLength": 1,
                                "format": "date",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "history": {
                                "enum": [
                                  "vendor_archive",
                                  "git",
                                  "wayback"
                                ]
                              },
                              "catalog": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "cid": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "cid"
                                ]
                              },
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "key",
                              "role",
                              "url",
                              "method",
                              "seenAt"
                            ]
                          },
                          "maxItems": 20,
                          "minItems": 1
                        },
                        "precedence": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "stated": {
                              "type": "boolean"
                            },
                            "order": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              },
                              "maxItems": 20,
                              "minItems": 0
                            },
                            "orderFormWinsOn": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              },
                              "maxItems": 20,
                              "minItems": 0
                            }
                          },
                          "required": [
                            "stated"
                          ]
                        }
                      },
                      "required": [
                        "refs",
                        "precedence"
                      ]
                    },
                    "paymentTerms": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "statementClosingDay": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 31
                        },
                        "paymentDueDay": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 31
                        },
                        "autopay": {
                          "type": "boolean",
                          "description": "Whether the issuer is instructed to collect automatically from the paying account."
                        },
                        "payingAccountId": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Registered payment account; omit to clear the default."
                        }
                      }
                    },
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "minLength": 1,
                      "format": "date-time"
                    },
                    "terms": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "proration": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "basis",
                          "sourceFactId"
                        ],
                        "properties": {
                          "basis": {
                            "enum": [
                              "actual_days",
                              "elapsed",
                              "days_365",
                              "days_30",
                              "stated"
                            ]
                          },
                          "sourceFactId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "resetBillingAnchor": {
                            "const": true
                          },
                          "creditDisposition": {
                            "const": "refund"
                          },
                          "creditAmount": {
                            "type": "string",
                            "pattern": "^[0-9]+$"
                          },
                          "chargeAmount": {
                            "type": "string",
                            "pattern": "^[0-9]+$"
                          }
                        }
                      }
                    },
                    "sourceDocumentIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 100
                    },
                    "acceptanceEvidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.cancel"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "expectedStatus",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedStatus": {
                      "enum": [
                        "draft",
                        "offer",
                        "active",
                        "rejected",
                        "terminated",
                        "expired"
                      ]
                    },
                    "effectiveAt": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "facts": {
                      "type": "object",
                      "maxProperties": 100
                    },
                    "cancellationAmounts": {
                      "type": "object",
                      "maxProperties": 100,
                      "additionalProperties": {
                        "type": "string",
                        "pattern": "^[0-9]+$"
                      }
                    },
                    "exchangeRate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "base",
                        "quote",
                        "date",
                        "numerator",
                        "denominator",
                        "evidence"
                      ],
                      "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                      "properties": {
                        "base": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "quote": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "numerator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "denominator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "acceptance"
                      ],
                      "properties": {
                        "acceptance": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "economic": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "service": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.change_quantity"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "activityKey",
                    "sourceFactId",
                    "requestedAt",
                    "expectedQuantity",
                    "quantity",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "activityKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "requestedAt": {
                      "type": "string",
                      "minLength": 1,
                      "format": "date-time"
                    },
                    "expectedQuantity": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "quantity": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "service": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "kind",
                              "ref"
                            ]
                          }
                        }
                      },
                      "required": [
                        "service"
                      ]
                    },
                    "bill": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "sourceFactId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "kind",
                              "ref"
                            ]
                          }
                        },
                        "invoicedAmount": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]*)$"
                        },
                        "taxAmount": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]*)$"
                        },
                        "dueDate": {
                          "type": "string",
                          "minLength": 1,
                          "format": "date"
                        }
                      },
                      "required": [
                        "sourceFactId",
                        "evidence",
                        "invoicedAmount"
                      ]
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document, activity_statement, contract that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.create"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "classification": {
                      "type": "object",
                      "maxProperties": 100,
                      "additionalProperties": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "expenseAccount": {
                            "type": "integer"
                          },
                          "expenseFunction": {
                            "type": "string"
                          },
                          "taxCode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "taxTreatment": {
                            "enum": [
                              "exclusive",
                              "inclusive",
                              null
                            ]
                          }
                        }
                      }
                    },
                    "lifecycle": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "term": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "index": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "startsOn": {
                              "type": "string",
                              "minLength": 1,
                              "format": "date",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "endsOn": {
                              "type": "string",
                              "minLength": 1,
                              "format": "date",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "rolling": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    }
                                  },
                                  "required": [
                                    "everyMonths"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3660
                                    }
                                  },
                                  "required": [
                                    "everyDays"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "index",
                            "startsOn"
                          ]
                        },
                        "atTermEnd": {
                          "enum": [
                            "renew",
                            "evergreen",
                            "end",
                            "renew_once"
                          ]
                        },
                        "renewal": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "length": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyMonths": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 120
                                    }
                                  },
                                  "required": [
                                    "everyMonths"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "everyDays": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3660
                                    }
                                  },
                                  "required": [
                                    "everyDays"
                                  ]
                                }
                              ]
                            },
                            "price": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "enum": [
                                        "same",
                                        "list"
                                      ]
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "uplift"
                                    },
                                    "bps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000
                                    },
                                    "terms": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "right": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "term": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "right",
                                          "term"
                                        ]
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "bps",
                                    "terms"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "capped"
                                    },
                                    "bps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000
                                    },
                                    "terms": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "right": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "term": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "right",
                                          "term"
                                        ]
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    },
                                    "index": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "uncappedWhen": {
                                      "type": "array",
                                      "items": {
                                        "enum": [
                                          "quantity_reduced",
                                          "term_shortened"
                                        ]
                                      },
                                      "maxItems": 2,
                                      "minItems": 0
                                    },
                                    "reducedLosesPrice": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "quantityTerms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "quantityTerms"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "bps",
                                    "terms"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "price"
                          ]
                        },
                        "notice": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "days": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 366
                            },
                            "basis": {
                              "enum": [
                                "calendar",
                                "weekdays"
                              ]
                            },
                            "remindDaysBefore": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 366
                            }
                          },
                          "required": [
                            "days",
                            "basis"
                          ]
                        },
                        "cancellation": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "windows": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "from": {
                                    "enum": [
                                      "term_start",
                                      "term_end"
                                    ]
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 366
                                  }
                                },
                                "required": [
                                  "from",
                                  "days"
                                ]
                              },
                              "maxItems": 20,
                              "minItems": 0
                            },
                            "onlyInWindows": {
                              "const": true
                            },
                            "otherwise": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "none"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "fee"
                                    },
                                    "right": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "right"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "type": {
                                      "const": "accelerate"
                                    },
                                    "rights": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "maxItems": 100,
                                      "minItems": 1
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "rights"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "windows",
                            "otherwise"
                          ]
                        },
                        "changes": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "termsChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "on_posting"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "next_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "locked_to_order"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "objection_until_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            },
                            "priceChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "no_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "held_for_paid_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "capped_at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "capPpm": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000000
                                    },
                                    "index": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "capPpm"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "mid_term_credit"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": []
                        }
                      },
                      "required": [
                        "term",
                        "atTermEnd",
                        "notice"
                      ]
                    },
                    "agreements": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "changes": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "termsChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "on_posting"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "next_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "locked_to_order"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "objection_until_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            },
                            "priceChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "no_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "held_for_paid_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "capped_at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "capPpm": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000000
                                    },
                                    "index": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "capPpm"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "mid_term_credit"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": []
                        },
                        "refs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "role": {
                                "enum": [
                                  "agreement",
                                  "order_form",
                                  "schedule",
                                  "policy"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1,
                                "format": "uri",
                                "maxLength": 2048
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              },
                              "method": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "pdf",
                                      "markdown",
                                      "html",
                                      "html_blanked",
                                      "html_extract",
                                      "embedded_json",
                                      "api_json",
                                      "text_render",
                                      "unstable"
                                    ]
                                  },
                                  "command": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  }
                                },
                                "required": [
                                  "kind"
                                ]
                              },
                              "seenAt": {
                                "type": "string",
                                "minLength": 1,
                                "format": "date",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "history": {
                                "enum": [
                                  "vendor_archive",
                                  "git",
                                  "wayback"
                                ]
                              },
                              "catalog": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "cid": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "cid"
                                ]
                              },
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "key",
                              "role",
                              "url",
                              "method",
                              "seenAt"
                            ]
                          },
                          "maxItems": 20,
                          "minItems": 1
                        },
                        "precedence": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "stated": {
                              "type": "boolean"
                            },
                            "order": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              },
                              "maxItems": 20,
                              "minItems": 0
                            },
                            "orderFormWinsOn": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              },
                              "maxItems": 20,
                              "minItems": 0
                            }
                          },
                          "required": [
                            "stated"
                          ]
                        }
                      },
                      "required": [
                        "refs",
                        "precedence"
                      ]
                    },
                    "paymentTerms": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "statementClosingDay": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 31
                        },
                        "paymentDueDay": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 31
                        },
                        "autopay": {
                          "type": "boolean",
                          "description": "Whether the issuer is instructed to collect automatically from the paying account."
                        },
                        "payingAccountId": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Registered payment account; omit to clear the default."
                        }
                      }
                    },
                    "templateDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "definition": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "vendorPlan": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "catalog": {
                              "type": "string"
                            },
                            "cid": {
                              "type": "string"
                            },
                            "template": {
                              "type": "string"
                            },
                            "relation": {
                              "enum": [
                                "adopted",
                                "derived"
                              ]
                            }
                          },
                          "required": [
                            "cid",
                            "template",
                            "relation"
                          ]
                        },
                        "lifecycle": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "term": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "index": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 9007199254740991
                                },
                                "startsOn": {
                                  "type": "string",
                                  "minLength": 1,
                                  "format": "date",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "endsOn": {
                                  "type": "string",
                                  "minLength": 1,
                                  "format": "date",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "rolling": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyMonths": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 120
                                        }
                                      },
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyDays": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 3660
                                        }
                                      },
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "index",
                                "startsOn"
                              ]
                            },
                            "atTermEnd": {
                              "enum": [
                                "renew",
                                "evergreen",
                                "end",
                                "renew_once"
                              ]
                            },
                            "renewal": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "length": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyMonths": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 120
                                        }
                                      },
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyDays": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 3660
                                        }
                                      },
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                },
                                "price": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "enum": [
                                            "same",
                                            "list"
                                          ]
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "uplift"
                                        },
                                        "bps": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000
                                        },
                                        "terms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "bps",
                                        "terms"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped"
                                        },
                                        "bps": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000
                                        },
                                        "terms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "uncappedWhen": {
                                          "type": "array",
                                          "items": {
                                            "enum": [
                                              "quantity_reduced",
                                              "term_shortened"
                                            ]
                                          },
                                          "maxItems": 2,
                                          "minItems": 0
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "bps",
                                        "terms"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "price"
                              ]
                            },
                            "notice": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "days": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 366
                                },
                                "basis": {
                                  "enum": [
                                    "calendar",
                                    "weekdays"
                                  ]
                                },
                                "remindDaysBefore": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 366
                                }
                              },
                              "required": [
                                "days",
                                "basis"
                              ]
                            },
                            "cancellation": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "windows": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "from": {
                                        "enum": [
                                          "term_start",
                                          "term_end"
                                        ]
                                      },
                                      "days": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 366
                                      }
                                    },
                                    "required": [
                                      "from",
                                      "days"
                                    ]
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                },
                                "onlyInWindows": {
                                  "const": true
                                },
                                "otherwise": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "none"
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "fee"
                                        },
                                        "right": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "right"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "accelerate"
                                        },
                                        "rights": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "rights"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "windows",
                                "otherwise"
                              ]
                            },
                            "changes": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "termsChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "on_posting"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "next_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "locked_to_order"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "objection_until_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                },
                                "priceChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "no_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "held_for_paid_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped_at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "capPpm": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 10000000
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "capPpm"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "mid_term_credit"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": []
                            }
                          },
                          "required": [
                            "term",
                            "atTermEnd",
                            "notice"
                          ]
                        },
                        "agreements": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "changes": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "termsChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "on_posting"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "next_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "locked_to_order"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "objection_until_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                },
                                "priceChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "no_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "held_for_paid_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped_at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "capPpm": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 10000000
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "capPpm"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "mid_term_credit"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": []
                            },
                            "refs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "role": {
                                    "enum": [
                                      "agreement",
                                      "order_form",
                                      "schedule",
                                      "policy"
                                    ]
                                  },
                                  "url": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "uri",
                                    "maxLength": 2048
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cid": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "method": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "kind": {
                                        "enum": [
                                          "pdf",
                                          "markdown",
                                          "html",
                                          "html_blanked",
                                          "html_extract",
                                          "embedded_json",
                                          "api_json",
                                          "text_render",
                                          "unstable"
                                        ]
                                      },
                                      "command": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 1000
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ]
                                  },
                                  "seenAt": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "history": {
                                    "enum": [
                                      "vendor_archive",
                                      "git",
                                      "wayback"
                                    ]
                                  },
                                  "catalog": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "cid": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "cid"
                                    ]
                                  },
                                  "documentId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "key",
                                  "role",
                                  "url",
                                  "method",
                                  "seenAt"
                                ]
                              },
                              "maxItems": 20,
                              "minItems": 1
                            },
                            "precedence": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "stated": {
                                  "type": "boolean"
                                },
                                "order": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                },
                                "orderFormWinsOn": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                }
                              },
                              "required": [
                                "stated"
                              ]
                            }
                          },
                          "required": [
                            "refs",
                            "precedence"
                          ]
                        },
                        "model": {
                          "const": "priced-rights-v1"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "plan": {
                          "enum": [
                            "on_sale",
                            "off_sale"
                          ]
                        },
                        "parties": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          },
                          "minItems": 1,
                          "maxItems": 100
                        },
                        "partyCategories": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "enum": [
                                "customer",
                                "vendor",
                                "founder",
                                "investor",
                                "provider",
                                "employee"
                              ]
                            },
                            "minItems": 0,
                            "maxItems": 6
                          }
                        },
                        "ledgers": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "classification": {
                                "enum": [
                                  "gaap",
                                  "contractual",
                                  "operational",
                                  "ownership",
                                  "planning"
                                ]
                              },
                              "unitKind": {
                                "enum": [
                                  "currency",
                                  "share",
                                  "usage",
                                  "credit",
                                  "right",
                                  "token",
                                  "other"
                                ]
                              },
                              "unitCode": {
                                "type": "string",
                                "minLength": 1
                              },
                              "decimals": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 18
                              },
                              "accountTemplate": {
                                "enum": [
                                  "gaap_startup",
                                  "contract_flow",
                                  "capacity",
                                  "meter",
                                  "entitlement",
                                  "issued_instrument"
                                ]
                              }
                            },
                            "required": [
                              "classification",
                              "unitKind",
                              "unitCode",
                              "decimals",
                              "accountTemplate"
                            ]
                          }
                        },
                        "activities": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "activityDocumentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "partyRole": {
                                "type": "string",
                                "minLength": 1
                              },
                              "ledgers": {
                                "type": "object",
                                "maxProperties": 100,
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "terms": {
                                "type": "object",
                                "maxProperties": 100,
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            },
                            "required": [
                              "key",
                              "activityDocumentId",
                              "partyRole"
                            ]
                          },
                          "minItems": 1,
                          "maxItems": 100
                        },
                        "consequences": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "sourceRights": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "minItems": 1,
                                "maxItems": 100
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "grant_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "expiresAtTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger",
                                      "quantity",
                                      "expiresAtTerm"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "consume_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantOccurrenceFact": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "overageRight": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger",
                                      "quantity",
                                      "grantOccurrenceFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "expire_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "valueLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "minimum"
                                      },
                                      "eligibleRights": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "minItems": 1,
                                        "maxItems": 100
                                      },
                                      "minimum": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "currencyTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "eligibleRights",
                                      "minimum",
                                      "currencyTerm",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "refund_unearned"
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "taxClaimFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "profit_allocation"
                                      },
                                      "result": {
                                        "enum": [
                                          "profit",
                                          "loss"
                                        ]
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "ownershipLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "ownershipLedger",
                                      "amount",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "profit_allocation"
                                      },
                                      "result": {
                                        "enum": [
                                          "profit",
                                          "loss"
                                        ]
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "ownershipBasis": {
                                        "const": "agreement"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "ownershipBasis",
                                      "amount",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "close_draws"
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "authorize_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "issue_units"
                                      },
                                      "capitalAllocation": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "shareCapital": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          },
                                          "sharePremium": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          }
                                        },
                                        "required": [
                                          "shareCapital",
                                          "sharePremium"
                                        ]
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      },
                                      "restricted": {
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "consideration",
                                      "restricted"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "capital_contribution"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "consideration"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "financing_commitment"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      },
                                      "liability": {
                                        "const": "owner_advance"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "consideration"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "capital_distribution"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "owner_draw"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "vest_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantOccurrenceFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "grantOccurrenceFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "vest_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantConsequence": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "grantConsequence"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "convert_claim"
                                      },
                                      "claimFact": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "currencyTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "equityAccount": {
                                        "enum": [
                                          3100,
                                          3110,
                                          3120
                                        ]
                                      },
                                      "units": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "ledger": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "quantity": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          },
                                          "restricted": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "ledger",
                                          "quantity",
                                          "restricted"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "claimFact",
                                      "amount",
                                      "currencyTerm",
                                      "monetaryLedger",
                                      "equityAccount"
                                    ]
                                  }
                                ]
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "transition"
                                      },
                                      "action": {
                                        "enum": [
                                          "accept",
                                          "cancel",
                                          "terminate"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "action"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "exercise"
                                      },
                                      "activityKey": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "activityKey"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "period_close"
                                      },
                                      "schedule": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "startTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "anchorTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "endTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "everyMonths": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "timing": {
                                            "enum": [
                                              "start",
                                              "end"
                                            ]
                                          },
                                          "offsetDays": {
                                            "type": "integer",
                                            "minimum": -365,
                                            "maximum": 365
                                          },
                                          "serviceEvidence": {
                                            "const": "elapsed_time"
                                          }
                                        },
                                        "required": [
                                          "startTerm",
                                          "everyMonths",
                                          "timing",
                                          "offsetDays"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "schedule"
                                    ]
                                  }
                                ]
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "acceptance",
                                    "economic",
                                    "service"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 100
                              }
                            },
                            "required": [
                              "key",
                              "sourceRights",
                              "trigger",
                              "rule",
                              "evidence"
                            ]
                          },
                          "minItems": 0,
                          "maxItems": 100
                        },
                        "creditPools": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "lots": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "right": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "eligibleRights": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "minItems": 1,
                                      "maxItems": 100
                                    }
                                  },
                                  "required": [
                                    "right",
                                    "eligibleRights"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 20
                              },
                              "drawAt": {
                                "enum": [
                                  "recognition",
                                  "billing"
                                ]
                              },
                              "drawOrder": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "expiry",
                                    "granted_first",
                                    "bought_first",
                                    "narrowest_scope",
                                    "oldest"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 5
                              }
                            },
                            "required": [
                              "key",
                              "lots",
                              "drawAt",
                              "drawOrder"
                            ]
                          },
                          "minItems": 1,
                          "maxItems": 20
                        }
                      },
                      "required": [
                        "model",
                        "name",
                        "parties",
                        "activities"
                      ]
                    },
                    "parties": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxProperties": 100
                    },
                    "terms": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1
                        },
                        "maxProperties": 100
                      },
                      "maxProperties": 100
                    },
                    "ledgerBindings": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxProperties": 100,
                      "description": "Ledger alias → existing ledger id. Every GAAP alias needs one. A business starts with its selected functional-currency ledger (USD only when omitted at initialization); binding a GAAP alias to another currency's canonical id (led_ + the zero-padded ISO 4217 numeric code, e.g. led_00000000000000000000000978 for EUR) opens that ledger with this contract, even while it is a draft."
                    },
                    "sourceDocumentIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 100
                    },
                    "concession": {
                      "type": "object",
                      "additionalProperties": false,
                      "description": "A concession offer this contract takes (concessions.create_offer), by `offerId` or by the `code` the customer typed: its discount becomes the terms of each right's `concession` reduction, from the right's start for the offer's months. `email` is the customer's address the offer is assigned to, or that its eligibility checks.",
                      "properties": {
                        "offerId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "code": {
                          "type": "string",
                          "minLength": 1
                        },
                        "email": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    }
                  },
                  "required": [
                    "parties"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, template, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.discard"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "contractId",
                    "expectedDocumentId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.give_notice"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "acceptance": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      },
                      "required": [
                        "acceptance"
                      ]
                    },
                    "givenAt": {
                      "type": "string",
                      "minLength": 1
                    },
                    "endsAt": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "sourceFactId",
                    "evidence",
                    "givenAt"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.observe_usage"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "activityKey",
                    "observations"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "activityKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "observations": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 200,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "producer",
                          "sourceId",
                          "revision",
                          "effectiveAt",
                          "evidence"
                        ],
                        "properties": {
                          "producer": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "sourceId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 256
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "effectiveAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "bucket": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "from",
                              "through"
                            ],
                            "properties": {
                              "from": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "through": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          },
                          "quantity": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          "observedAmount": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          "unit": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "attribution": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "customer": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "customerContract": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "holder": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 254
                              },
                              "team": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "function": {
                                "enum": [
                                  "cost_of_revenue",
                                  "research_and_development",
                                  "sales_and_marketing",
                                  "general_and_administrative",
                                  "other"
                                ]
                              },
                              "project": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "key": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "tags": {
                                "type": "object",
                                "maxProperties": 8,
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                }
                              }
                            }
                          },
                          "evidence": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "kind",
                                "ref"
                              ],
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "tap_message",
                                    "x402_receipt",
                                    "chain_tx",
                                    "signed_doc",
                                    "stripe_object",
                                    "other"
                                  ]
                                },
                                "ref": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "signer": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.offer"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "expectedStatus",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedStatus": {
                      "enum": [
                        "draft",
                        "offer",
                        "active",
                        "rejected",
                        "terminated",
                        "expired"
                      ]
                    },
                    "effectiveAt": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "facts": {
                      "type": "object",
                      "maxProperties": 100
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "acceptance"
                      ],
                      "properties": {
                        "acceptance": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "economic": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "service": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.reconcile_usage"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "sourceFactId",
                    "effectiveAt",
                    "source",
                    "lines",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "replacesBillId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "source": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "enum": [
                            "invoice",
                            "statement"
                          ]
                        },
                        "documentId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "reference": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "final": {
                      "const": true
                    },
                    "dueDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "invoiceTotal": {
                      "type": "string",
                      "pattern": "^(0|-?[1-9][0-9]*)$"
                    },
                    "lines": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 200,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "lineKey",
                          "amount"
                        ],
                        "properties": {
                          "lineKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512
                          },
                          "activityKey": {
                            "type": "string",
                            "minLength": 1
                          },
                          "period": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "from",
                              "through"
                            ],
                            "properties": {
                              "from": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "through": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          },
                          "quantity": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^(0|-?[1-9][0-9]*)$"
                          },
                          "taxAmount": {
                            "type": "string",
                            "pattern": "^(0|-?[1-9][0-9]*)$"
                          },
                          "credit": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          "correction": {
                            "const": true
                          },
                          "handledElsewhere": {
                            "const": true
                          }
                        }
                      }
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "billing"
                      ],
                      "properties": {
                        "billing": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.record"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "activityKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "occurrenceKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "invoiceReference": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The vendor's invoice number for received billing, separately from the recording's source fact."
                    },
                    "replacesBillId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Explicitly reverse this vendor occurrenceId or usage reconciliationId and record the new bill in the same transaction."
                    },
                    "effectiveAt": {
                      "type": "string",
                      "minLength": 1,
                      "format": "date-time"
                    },
                    "dueDate": {
                      "type": "string",
                      "minLength": 1,
                      "format": "date",
                      "description": "Evidenced due date for a priced-right billing claim only; omit when unknown."
                    },
                    "facts": {
                      "type": "object",
                      "maxProperties": 100,
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "occurrenceId"
                            ],
                            "properties": {
                              "occurrenceId": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "claimId",
                              "component"
                            ],
                            "properties": {
                              "claimId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "component": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "originLedgerId",
                                  "accountCode"
                                ],
                                "properties": {
                                  "originLedgerId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "accountCode": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                }
                              }
                            }
                          }
                        ]
                      }
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "payment": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "service": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "acceptance": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "billing": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "economic": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    },
                    "correctsOccurrenceId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "exchangeRate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "base",
                        "quote",
                        "date",
                        "numerator",
                        "denominator",
                        "evidence"
                      ],
                      "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                      "properties": {
                        "base": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "quote": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "numerator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "denominator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "paymentMethodId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "phase": {
                      "enum": [
                        "billing",
                        "delivery",
                        "usage",
                        "recognition",
                        "exercise",
                        "period_close"
                      ]
                    },
                    "serviceShare": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "index",
                        "count",
                        "billingOccurrenceId"
                      ],
                      "properties": {
                        "billingOccurrenceId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "index": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 12
                        },
                        "count": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 12
                        }
                      }
                    },
                    "adjustment": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "amendment": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "cid": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "cid"
                              ]
                            }
                          },
                          "required": [
                            "amendment"
                          ]
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "changeId": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "changeId"
                          ]
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "trueUp": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "minLength": 1,
                                  "format": "date-time"
                                },
                                "through": {
                                  "type": "string",
                                  "minLength": 1,
                                  "format": "date-time"
                                }
                              },
                              "required": [
                                "from",
                                "through"
                              ]
                            }
                          },
                          "required": [
                            "trueUp"
                          ]
                        }
                      ]
                    },
                    "invoicedAmount": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "taxAmount": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "consequenceKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "obligationKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "period": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "from",
                        "through"
                      ],
                      "properties": {
                        "from": {
                          "type": "string",
                          "minLength": 1,
                          "format": "date-time"
                        },
                        "through": {
                          "type": "string",
                          "minLength": 1,
                          "format": "date-time"
                        }
                      }
                    }
                  },
                  "required": [
                    "contractId",
                    "activityKey",
                    "occurrenceKey",
                    "sourceFactId",
                    "effectiveAt"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document, activity_statement, contract that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.renew"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "termIndex": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "terms": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "indexFacts": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": -10000,
                        "maximum": 100000
                      }
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "acceptance": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      },
                      "required": [
                        "acceptance"
                      ]
                    },
                    "agreements": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "changes": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "termsChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "on_posting"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "next_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "locked_to_order"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "objection_until_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            },
                            "priceChange": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "no_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "after_notice"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "held_for_paid_term"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "noticeDays": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 366
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "noticeDays"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "capped_at_renewal"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "capPpm": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000000
                                    },
                                    "index": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule",
                                    "capPpm"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "rule": {
                                      "const": "mid_term_credit"
                                    },
                                    "from": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "rule"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": []
                        },
                        "refs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "role": {
                                "enum": [
                                  "agreement",
                                  "order_form",
                                  "schedule",
                                  "policy"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1,
                                "format": "uri",
                                "maxLength": 2048
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              },
                              "method": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "pdf",
                                      "markdown",
                                      "html",
                                      "html_blanked",
                                      "html_extract",
                                      "embedded_json",
                                      "api_json",
                                      "text_render",
                                      "unstable"
                                    ]
                                  },
                                  "command": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  }
                                },
                                "required": [
                                  "kind"
                                ]
                              },
                              "seenAt": {
                                "type": "string",
                                "minLength": 1,
                                "format": "date",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "history": {
                                "enum": [
                                  "vendor_archive",
                                  "git",
                                  "wayback"
                                ]
                              },
                              "catalog": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "cid": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "cid"
                                ]
                              },
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "key",
                              "role",
                              "url",
                              "method",
                              "seenAt"
                            ]
                          },
                          "maxItems": 20,
                          "minItems": 1
                        },
                        "precedence": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "stated": {
                              "type": "boolean"
                            },
                            "order": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              },
                              "maxItems": 20,
                              "minItems": 0
                            },
                            "orderFormWinsOn": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              },
                              "maxItems": 20,
                              "minItems": 0
                            }
                          },
                          "required": [
                            "stated"
                          ]
                        }
                      },
                      "required": [
                        "refs",
                        "precedence"
                      ]
                    },
                    "length": {
                      "anyOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "everyMonths": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 120
                            }
                          },
                          "required": [
                            "everyMonths"
                          ]
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "everyDays": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 3660
                            }
                          },
                          "required": [
                            "everyDays"
                          ]
                        }
                      ]
                    },
                    "rollover": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "activityKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "obligationKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "facts": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "activityKey",
                        "obligationKey",
                        "facts"
                      ]
                    }
                  },
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "sourceFactId",
                    "termIndex",
                    "evidence"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.resolve_usage_review"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "effectiveAt",
                    "decision",
                    "reason"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "decision": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    "items": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "reason",
                          "activityKey",
                          "periodKey",
                          "sourceFactId"
                        ],
                        "properties": {
                          "reason": {
                            "enum": [
                              "proration_basis_differs",
                              "amendment_bill_reversed",
                              "amendment_service_overlap",
                              "invoice_overlap",
                              "accrual_overlap",
                              "tax_differs",
                              "tax_amount_unconfirmed",
                              "credit_expired",
                              "credit_unfunded",
                              "billed_twice",
                              "seat_count_differs",
                              "recognized_after_end",
                              "unit_differs"
                            ]
                          },
                          "activityKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4096
                          },
                          "periodKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4096
                          },
                          "sourceFactId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4096
                          }
                        }
                      }
                    },
                    "priceDifferences": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "activityKey",
                          "basis",
                          "latest",
                          "billed",
                          "bills",
                          "standing"
                        ],
                        "properties": {
                          "activityKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4096
                          },
                          "basis": {
                            "enum": [
                              "amendment_credit",
                              "amendment_charge"
                            ]
                          },
                          "latest": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "billed": {
                            "type": "string",
                            "pattern": "^[0-9]+$"
                          },
                          "bills": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "standing": {
                            "type": "array",
                            "maxItems": 10,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "effectiveAt",
                                "computed",
                                "billed",
                                "facts"
                              ],
                              "properties": {
                                "effectiveAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "computed": {
                                  "type": "string"
                                },
                                "billed": {
                                  "type": "string"
                                },
                                "facts": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "type": "string"
                                  }
                                },
                                "occurrenceId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 4096
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "unmatchedLines": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "reconciliationId",
                          "lineKey"
                        ],
                        "properties": {
                          "reconciliationId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4096
                          },
                          "lineKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4096
                          },
                          "accountedBy": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "cid"
                            ],
                            "properties": {
                              "cid": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 4096
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.reverse_economics"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "activityKey",
                    "occurrenceId",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "activityKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "occurrenceId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    },
                    "refundSettled": {
                      "const": true
                    },
                    "recognitionOnly": {
                      "const": true
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.terminate"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "expectedStatus",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedStatus": {
                      "enum": [
                        "draft",
                        "offer",
                        "active",
                        "rejected",
                        "terminated",
                        "expired"
                      ]
                    },
                    "effectiveAt": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "facts": {
                      "type": "object",
                      "maxProperties": 100
                    },
                    "cancellationAmounts": {
                      "type": "object",
                      "maxProperties": 100,
                      "additionalProperties": {
                        "type": "string",
                        "pattern": "^[0-9]+$"
                      }
                    },
                    "exchangeRate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "base",
                        "quote",
                        "date",
                        "numerator",
                        "denominator",
                        "evidence"
                      ],
                      "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                      "properties": {
                        "base": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "quote": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "numerator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "denominator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "acceptance"
                      ],
                      "properties": {
                        "acceptance": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "economic": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "service": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.void"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "reason",
                    "evidence"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    },
                    "preview": {
                      "const": true
                    },
                    "expectedPlanDigest": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "contracts.withdraw_notice"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "evidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "acceptance": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      },
                      "required": [
                        "acceptance"
                      ]
                    }
                  },
                  "required": [
                    "contractId",
                    "expectedDocumentId",
                    "sourceFactId",
                    "evidence"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "documents.receive"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "enum": [
                        "source_document",
                        "activity",
                        "template",
                        "contract",
                        "activity_statement",
                        "contract_lifecycle_statement",
                        "image"
                      ]
                    },
                    "contentBase64": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 13981016,
                      "pattern": "^[A-Za-z0-9+/]+={0,2}$",
                      "description": "The exact artifact bytes encoded as base64: at most 10485760 bytes for a source_document, 262144 bytes for the structured kinds."
                    },
                    "externalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$",
                      "description": "What the document is called, in the founder's words. Omit to take it from the content."
                    }
                  },
                  "required": [
                    "kind",
                    "contentBase64"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "documents.relate"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "fromDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "toDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "relation": {
                      "enum": [
                        "supersedes",
                        "based_on",
                        "amends",
                        "incorporates",
                        "responds_to"
                      ]
                    }
                  },
                  "required": [
                    "fromDocumentId",
                    "toDocumentId",
                    "relation"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.agreement_proposal"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ingestionId",
                    "agreementText",
                    "partyBindings"
                  ],
                  "properties": {
                    "ingestionId": {
                      "type": "string"
                    },
                    "agreementText": {
                      "type": "string"
                    },
                    "templateDocumentId": {
                      "type": "string"
                    },
                    "partyBindings": {
                      "type": "object",
                      "maxProperties": 100,
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "ledgerBindings": {
                      "type": "object",
                      "maxProperties": 100,
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.amendment_proposal"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ingestionId",
                    "amendmentText",
                    "contractId",
                    "expectedDocumentId"
                  ],
                  "properties": {
                    "ingestionId": {
                      "type": "string"
                    },
                    "amendmentText": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "expectedDocumentId": {
                      "type": "string"
                    },
                    "acceptanceEvidence": {
                      "type": "array",
                      "minItems": 0,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.attach_original"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "ingestionId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "file": {
                      "type": "object",
                      "description": "Retains exact source bytes. Text/Markdown/JSON bypasses PDF/OCR. Candidate PDF/image extraction retains source-bound text before classification; supported PDFs are limited to 50 pages, with explicit unsupported/limit failures. Optional attachments do not verify supplied transcriptions.",
                      "additionalProperties": false,
                      "properties": {
                        "filename": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "contentType": {
                          "enum": [
                            "application/pdf",
                            "text/plain",
                            "text/markdown",
                            "text/csv",
                            "application/json",
                            "image/png",
                            "image/jpeg",
                            "image/webp"
                          ]
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10485760,
                          "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                        }
                      },
                      "required": [
                        "filename",
                        "contentType",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "ingestionId",
                    "file"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.credit_proposal"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ingestionId",
                    "creditText",
                    "expenseTargets"
                  ],
                  "properties": {
                    "ingestionId": {
                      "type": "string"
                    },
                    "creditText": {
                      "type": "string"
                    },
                    "expenseTargets": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "contractId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          },
                          "activityKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          }
                        },
                        "required": [
                          "contractId",
                          "activityKey"
                        ]
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.invoice_candidates"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "ingestionId": {
                      "type": "string"
                    },
                    "invoiceText": {
                      "type": "string",
                      "maxLength": 65536
                    }
                  },
                  "required": [
                    "ingestionId",
                    "invoiceText"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.receipt_proposal"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ingestionId",
                    "receiptText",
                    "expenseTargets",
                    "financialAccountId"
                  ],
                  "properties": {
                    "ingestionId": {
                      "type": "string"
                    },
                    "receiptText": {
                      "type": "string"
                    },
                    "expenseTargets": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "contractId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          },
                          "activityKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          }
                        },
                        "required": [
                          "contractId",
                          "activityKey"
                        ]
                      }
                    },
                    "financialAccountId": {
                      "type": "string"
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.reissue_upload"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "ingestionId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "role": {
                      "enum": [
                        "primary",
                        "original"
                      ]
                    }
                  },
                  "required": [
                    "ingestionId",
                    "role"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.resolve"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "ingestionId": {
                      "type": "string"
                    },
                    "expectedProposalRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 7
                    },
                    "expenseTargets": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "contractId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          },
                          "activityKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          }
                        },
                        "required": [
                          "contractId",
                          "activityKey"
                        ]
                      }
                    },
                    "invoiceText": {
                      "type": "string",
                      "maxLength": 65536
                    },
                    "invoiceChoices": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "headers": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "vendor": {
                              "type": "string",
                              "pattern": "^(?:none|v[0-9]{1,3})$"
                            },
                            "buyer": {
                              "type": "string",
                              "pattern": "^(?:none|v[0-9]{1,3})$"
                            },
                            "externalId": {
                              "type": "string",
                              "pattern": "^(?:none|v[0-9]{1,3})$"
                            },
                            "date": {
                              "type": "string",
                              "pattern": "^(?:none|v[0-9]{1,3})$"
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^(?:none|v[0-9]{1,3})$"
                            },
                            "total": {
                              "type": "string",
                              "pattern": "^(?:none|v[0-9]{1,3})$"
                            }
                          },
                          "required": [
                            "vendor",
                            "buyer",
                            "externalId",
                            "date",
                            "currency",
                            "total"
                          ]
                        },
                        "service": {
                          "enum": [
                            "delivered",
                            "not_delivered",
                            "unclear"
                          ]
                        },
                        "rows": {
                          "type": "array",
                          "maxItems": 64,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "role": {
                                "enum": [
                                  "charge",
                                  "tax",
                                  "summary",
                                  "other",
                                  "unclear"
                                ]
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(?:none|v[0-9]{1,3})$"
                              }
                            },
                            "required": [
                              "role",
                              "amount"
                            ]
                          }
                        }
                      },
                      "required": [
                        "headers",
                        "service",
                        "rows"
                      ]
                    }
                  },
                  "required": [
                    "ingestionId",
                    "expectedProposalRevision",
                    "expenseTargets"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.start"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "source": {
                      "anyOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "const": "text"
                            },
                            "format": {
                              "enum": [
                                "text",
                                "markdown"
                              ]
                            },
                            "text": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 65536,
                              "description": "Retention limit is 64 KiB of UTF-8; current classification requires the whole serialized request (text, instructions and business context) to fit within 64 KiB, otherwise polling reports classifier_input_too_large."
                            }
                          },
                          "required": [
                            "type",
                            "format",
                            "text"
                          ]
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "const": "document"
                            },
                            "documentId": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "type",
                            "documentId"
                          ]
                        },
                        {
                          "type": "object",
                          "description": "Retains exact source bytes. Text/Markdown/JSON bypasses PDF/OCR. Candidate PDF/image extraction retains source-bound text before classification; supported PDFs are limited to 50 pages, with explicit unsupported/limit failures. Optional attachments do not verify supplied transcriptions.",
                          "additionalProperties": false,
                          "properties": {
                            "filename": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "contentType": {
                              "enum": [
                                "application/pdf",
                                "text/plain",
                                "text/markdown",
                                "text/csv",
                                "application/json",
                                "image/png",
                                "image/jpeg",
                                "image/webp"
                              ]
                            },
                            "size": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 10485760,
                              "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                            },
                            "type": {
                              "const": "file"
                            }
                          },
                          "required": [
                            "filename",
                            "contentType",
                            "size",
                            "type"
                          ]
                        }
                      ]
                    },
                    "mode": {
                      "enum": [
                        "propose",
                        "auto_record"
                      ],
                      "default": "propose"
                    },
                    "recordingPolicy": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "minimumConfidencePercent": {
                          "type": "integer",
                          "minimum": 60,
                          "maximum": 100
                        },
                        "fundingAccounts": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "financialAccountId",
                              "currency",
                              "last4",
                              "kind",
                              "glAccountCode"
                            ],
                            "properties": {
                              "financialAccountId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "last4": {
                                "type": "string",
                                "pattern": "^[0-9]{4}$"
                              },
                              "kind": {
                                "enum": [
                                  "checking",
                                  "savings",
                                  "card",
                                  "wallet",
                                  "other"
                                ]
                              },
                              "glAccountCode": {
                                "enum": [
                                  1110,
                                  1310,
                                  1410,
                                  2190,
                                  2135
                                ]
                              },
                              "ownerPartyId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "providerPartyId": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        },
                        "targets": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "contractId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              },
                              "activityKey": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": [
                              "contractId",
                              "activityKey",
                              "cid"
                            ]
                          }
                        }
                      },
                      "required": [
                        "minimumConfidencePercent",
                        "targets"
                      ]
                    },
                    "expenseTargets": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "contractId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          },
                          "activityKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          }
                        },
                        "required": [
                          "contractId",
                          "activityKey"
                        ]
                      },
                      "description": "Optional bounded hints for structured vendor-invoice proposals against existing activities. Requires whole-domain document, subject, party and ledger reads, plus activity_effects report access. Automatic execution requires a separate explicit frozen recordingPolicy."
                    },
                    "original": {
                      "type": "object",
                      "description": "Retains exact source bytes. Text/Markdown/JSON bypasses PDF/OCR. Candidate PDF/image extraction retains source-bound text before classification; supported PDFs are limited to 50 pages, with explicit unsupported/limit failures. Optional attachments do not verify supplied transcriptions.",
                      "additionalProperties": false,
                      "properties": {
                        "filename": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "contentType": {
                          "enum": [
                            "application/pdf",
                            "text/plain",
                            "text/markdown",
                            "text/csv",
                            "application/json",
                            "image/png",
                            "image/jpeg",
                            "image/webp"
                          ]
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10485760,
                          "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                        }
                      },
                      "required": [
                        "filename",
                        "contentType",
                        "size"
                      ]
                    },
                    "relationship": {
                      "enum": [
                        "transcription",
                        "summary",
                        "related_original"
                      ],
                      "description": "Caller-declared relationship between primary text and an optional original; retained as unverified."
                    }
                  },
                  "required": [
                    "source"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "ingestions.statement_matches"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "ingestionId": {
                      "type": "string"
                    },
                    "statementText": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ingestionId",
                    "statementText"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "journal.post"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "description",
                    "currency",
                    "lines"
                  ],
                  "properties": {
                    "description": {
                      "type": "string",
                      "maxLength": 1024
                    },
                    "currency": {
                      "type": "string",
                      "description": "The functional currency, or a token's CAIP-19 for a wallet's token movement: amounts are then in the token's smallest unit and post in its own ledger.",
                      "examples": [
                        "USD",
                        "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
                      ]
                    },
                    "decimals": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 18,
                      "description": "Optional precision read from the token contract for its first movement. When omitted for an unlisted ERC-20 token, the control plane reads it through ValidationCloud on a configured chain. Kept on the token's ledger; a later entry may omit it."
                    },
                    "externalRef": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "stripeFeeTransactionId": {
                      "type": "string",
                      "description": "Stripe balance transaction for a standalone fee. Requires its hashed stripe-funds externalRef. An existing fee source leaves the books unchanged; raw provider identity stays in the private command receipt, not the journal event."
                    },
                    "lines": {
                      "type": "array",
                      "minItems": 2,
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "required": [
                          "accountCode",
                          "direction",
                          "amount"
                        ],
                        "properties": {
                          "accountCode": {
                            "type": "integer"
                          },
                          "direction": {
                            "enum": [
                              "debit",
                              "credit"
                            ]
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          "subKey": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "enum": [
                                  0,
                                  1,
                                  2,
                                  3,
                                  4,
                                  5,
                                  6
                                ]
                              },
                              "symbol": {
                                "type": "string"
                              },
                              "partyId": {
                                "type": "string"
                              },
                              "sku": {
                                "type": "string"
                              },
                              "financialAccountId": {
                                "type": "string"
                              },
                              "taxCodeId": {
                                "type": "string"
                              },
                              "expenseFunction": {
                                "enum": [
                                  "cost_of_revenue",
                                  "research_and_development",
                                  "sales_and_marketing",
                                  "general_and_administrative",
                                  "other"
                                ]
                              }
                            }
                          },
                          "asset": {
                            "type": "string"
                          },
                          "assetAmount": {
                            "type": "string"
                          },
                          "externalId": {
                            "type": "string",
                            "maxLength": 200
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "journal.void"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "eventId"
                  ],
                  "properties": {
                    "eventId": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "reason": {
                      "type": "string",
                      "maxLength": 200
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "members.grant"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "principalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "description": "A principal id the platform knows, obtained from the person's sign-in; never invented."
                    },
                    "role": {
                      "enum": [
                        "owner",
                        "member"
                      ]
                    },
                    "preset": {
                      "type": "object",
                      "properties": {
                        "name": {},
                        "version": {
                          "const": 1
                        }
                      },
                      "required": [
                        "name",
                        "version"
                      ]
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      },
                      "description": "Explicit permission statements, required for members."
                    }
                  },
                  "required": [
                    "principalId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "members.revoke"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "principalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": [
                    "principalId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "messages.send"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "to": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The recipient's party id in these books; it must be a party this business holds a platform-bound agreement with. Omit it to write to Economico (the only recipient a demo business has; the result then names no party)."
                    },
                    "topic": {
                      "enum": [
                        "support",
                        "feature_suggestion",
                        "general"
                      ],
                      "description": "support: something is broken, unclear or you are stuck. feature_suggestion: a capability Economico does not have yet. general: anything else."
                    },
                    "inReplyTo": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The id of a message this business received. The reply goes to its sender; topic and subject default from it."
                    },
                    "about": {
                      "type": "array",
                      "maxItems": 10,
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "description": "Document ids in these books the message is about, such as an invoice you received."
                    },
                    "subject": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "body": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 5000
                    },
                    "context": {
                      "type": "object",
                      "maxProperties": 20,
                      "propertyNames": {
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "additionalProperties": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "description": "Optional structured detail about what you were doing, such as the tool or workflow you attempted."
                    }
                  },
                  "required": [
                    "body"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "opportunities.link"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "opportunityId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "contractDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "activityKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "occurrenceKey": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "opportunityId",
                    "expectedRevision",
                    "contractId",
                    "contractDocumentId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "opportunities.lose"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "opportunityId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "opportunityId",
                    "expectedRevision",
                    "reason"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "opportunities.open"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "opportunityKey": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "cohort": {
                      "enum": [
                        "customer",
                        "vendor",
                        "financing"
                      ]
                    },
                    "kind": {
                      "enum": [
                        "new",
                        "renewal",
                        "expansion"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedValue": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "weightBps": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 10000
                    },
                    "expectedCloseOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "stage": {
                      "enum": [
                        "open",
                        "qualified",
                        "proposed"
                      ]
                    },
                    "predecessorContractId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "opportunityKey",
                    "name",
                    "partyId",
                    "cohort",
                    "kind",
                    "currency"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "opportunities.stage"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "opportunityId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "stage": {
                      "enum": [
                        "open",
                        "qualified",
                        "proposed"
                      ]
                    },
                    "weightBps": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 10000
                    },
                    "expectedValue": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "expectedCloseOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "opportunityId",
                    "expectedRevision",
                    "stage"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "parties.add_contact"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "contactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "email": {
                      "type": "string",
                      "format": "email",
                      "maxLength": 254
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "contactId",
                    "partyId",
                    "name",
                    "email"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "parties.archive"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "partyId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "parties.create"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "legalName": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500,
                      "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$",
                      "description": "The registered name, when it differs from the name the party is known by (Y Combinator's fund, say)."
                    },
                    "url": {
                      "type": "string"
                    },
                    "logoUrl": {
                      "type": "string",
                      "minLength": 1,
                      "description": "A logo in Economico's shared public images, as the canonical https://logos.economi.co/logos/{owner-id}/{cid}.{png|jpg|webp} link an upload returns. The form is checked, not looked up: any link in that form is accepted, and any other link is refused. Anyone with the link can view the image; after replacing an image, set its new link here."
                    },
                    "iri": {
                      "type": "string",
                      "minLength": 1
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "enum": [
                          "customer",
                          "vendor",
                          "founder",
                          "investor",
                          "provider",
                          "employee"
                        ]
                      }
                    },
                    "relatedParty": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "partyId",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "parties.rebind_vendor_identity"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "vendorCatalog": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedPartyId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "pattern": "\\S",
                      "maxLength": 2000
                    }
                  },
                  "required": [
                    "vendorCatalog",
                    "expectedPartyId",
                    "partyId",
                    "reason"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "parties.remove_contact"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "contactId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "partyId",
                    "contactId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "parties.set_address"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "address": {
                      "type": "object",
                      "properties": {
                        "line1": {
                          "type": "string",
                          "minLength": 1
                        },
                        "line2": {
                          "type": "string",
                          "minLength": 1
                        },
                        "city": {
                          "type": "string",
                          "minLength": 1
                        },
                        "region": {
                          "type": "string",
                          "minLength": 1
                        },
                        "postalCode": {
                          "type": "string",
                          "minLength": 1
                        },
                        "country": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "line1": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "line1"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "line2": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "line2"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "city": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "city"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "region": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "region"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "postalCode": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "postalCode"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "country": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "country"
                          ]
                        }
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "partyId",
                    "address"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "parties.update"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "legalName": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500,
                      "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$",
                      "description": "The registered name, when it differs from the name the party is known by (Y Combinator's fund, say)."
                    },
                    "url": {
                      "type": "string"
                    },
                    "logoUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "A logo in Economico's shared public images, as the canonical https://logos.economi.co/logos/{owner-id}/{cid}.{png|jpg|webp} link an upload returns. The form is checked, not looked up: any link in that form is accepted, and any other link is refused. Anyone with the link can view the image; after replacing an image, set its new link here. Omit it to keep the current logo; null clears it."
                    },
                    "iri": {
                      "type": "string",
                      "minLength": 1
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "enum": [
                          "customer",
                          "vendor",
                          "founder",
                          "investor",
                          "provider",
                          "employee"
                        ]
                      }
                    },
                    "relatedParty": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "partyId"
                  ],
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "relatedParty": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "relatedParty"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "legalName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "legalName"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "url"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "logoUrl": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "logoUrl"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "categories": {
                          "type": "array"
                        }
                      },
                      "required": [
                        "categories"
                      ]
                    }
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payment_endpoints.register"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "paymentEndpointId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "uri": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "methods": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "direction": {
                            "enum": [
                              "in",
                              "out"
                            ]
                          },
                          "rail": {
                            "enum": [
                              "ach",
                              "ach_same_day",
                              "fedwire",
                              "rtp",
                              "sepa",
                              "sepa_instant",
                              "swift",
                              "onchain",
                              "internal",
                              "card"
                            ]
                          },
                          "asset": {
                            "type": "string",
                            "minLength": 1
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "etaSeconds": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "minAmountMinor": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          "maxAmountMinor": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          }
                        },
                        "required": [
                          "direction",
                          "rail",
                          "asset"
                        ]
                      }
                    }
                  },
                  "required": [
                    "paymentEndpointId",
                    "methods"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payment_endpoints.update"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "paymentEndpointId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "label": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "paymentEndpointId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payments.allocate"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "paymentId",
                    "sourceFactId",
                    "effectiveAt",
                    "evidence",
                    "allocations"
                  ],
                  "properties": {
                    "exchangeRate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "base",
                        "quote",
                        "date",
                        "numerator",
                        "denominator",
                        "evidence"
                      ],
                      "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                      "properties": {
                        "base": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "quote": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "numerator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "denominator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "paymentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "allocations": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "claimId",
                          "component",
                          "amount"
                        ],
                        "properties": {
                          "claimId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$"
                          },
                          "cashAmount": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$"
                          },
                          "component": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "originLedgerId",
                              "accountCode"
                            ],
                            "properties": {
                              "originLedgerId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "accountCode": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payments.process"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "payment",
                    "rail",
                    "netAmount",
                    "evidence"
                  ],
                  "properties": {
                    "payment": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "financialAccountId",
                        "direction",
                        "amount",
                        "currency",
                        "partyId",
                        "effectiveAt",
                        "sourceFactId",
                        "evidence",
                        "allocations"
                      ],
                      "properties": {
                        "exchangeRate": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "base",
                            "quote",
                            "date",
                            "numerator",
                            "denominator",
                            "evidence"
                          ],
                          "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                          "properties": {
                            "base": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "quote": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "date": {
                              "type": "string",
                              "format": "date"
                            },
                            "numerator": {
                              "type": "string",
                              "pattern": "^[1-9][0-9]*$"
                            },
                            "denominator": {
                              "type": "string",
                              "pattern": "^[1-9][0-9]*$"
                            },
                            "evidence": {
                              "type": "array",
                              "minItems": 1,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "ref"
                                ],
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "tap_message",
                                      "x402_receipt",
                                      "chain_tx",
                                      "signed_doc",
                                      "stripe_object",
                                      "other"
                                    ]
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        },
                        "refundsFundingClaim": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "claimId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "component": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "originLedgerId",
                                "accountCode"
                              ],
                              "properties": {
                                "originLedgerId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "accountCode": {
                                  "type": "integer"
                                }
                              }
                            }
                          },
                          "required": [
                            "claimId",
                            "component"
                          ]
                        },
                        "financialAccountId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "direction": {
                          "enum": [
                            "in",
                            "out"
                          ]
                        },
                        "amount": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "currency": {
                          "type": "string",
                          "minLength": 1,
                          "description": "ISO currency, or a CAIP-19 token for a company-owned wallet; amount is in that unit's exact minor units."
                        },
                        "partyId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "effectiveAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "sourceFactId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "allocations": {
                          "type": "array",
                          "minItems": 0,
                          "maxItems": 100,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "claimId",
                              "component",
                              "amount"
                            ],
                            "properties": {
                              "claimId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^[1-9][0-9]*$"
                              },
                              "cashAmount": {
                                "type": "string",
                                "pattern": "^[1-9][0-9]*$"
                              },
                              "component": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "originLedgerId",
                                  "accountCode"
                                ],
                                "properties": {
                                  "originLedgerId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "accountCode": {
                                    "type": "integer"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "rail": {
                      "enum": [
                        "ach",
                        "ach_same_day",
                        "fedwire",
                        "rtp",
                        "sepa",
                        "sepa_instant",
                        "swift",
                        "onchain",
                        "internal",
                        "card"
                      ]
                    },
                    "netAmount": {
                      "type": "string",
                      "pattern": "^(0|-?[1-9][0-9]*)$"
                    },
                    "feeFacts": {
                      "type": "object",
                      "maxProperties": 20,
                      "additionalProperties": {
                        "type": "string",
                        "pattern": "^(0|[1-9][0-9]*)$"
                      }
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "additionalProperties": false,
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payments.record"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "financialAccountId",
                    "direction",
                    "amount",
                    "currency",
                    "partyId",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence",
                    "allocations"
                  ],
                  "properties": {
                    "exchangeRate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "base",
                        "quote",
                        "date",
                        "numerator",
                        "denominator",
                        "evidence"
                      ],
                      "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                      "properties": {
                        "base": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "quote": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "numerator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "denominator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "refundsFundingClaim": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "claimId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "component": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "originLedgerId",
                            "accountCode"
                          ],
                          "properties": {
                            "originLedgerId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "accountCode": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "required": [
                        "claimId",
                        "component"
                      ]
                    },
                    "financialAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "direction": {
                      "enum": [
                        "in",
                        "out"
                      ]
                    },
                    "amount": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]*$"
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 1,
                      "description": "ISO currency, or a CAIP-19 token for a company-owned wallet; amount is in that unit's exact minor units."
                    },
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "allocations": {
                      "type": "array",
                      "minItems": 0,
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "claimId",
                          "component",
                          "amount"
                        ],
                        "properties": {
                          "claimId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$"
                          },
                          "cashAmount": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$"
                          },
                          "component": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "originLedgerId",
                              "accountCode"
                            ],
                            "properties": {
                              "originLedgerId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "accountCode": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payments.reverse"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "paymentId",
                    "sourceFactId",
                    "effectiveAt",
                    "evidence"
                  ],
                  "properties": {
                    "paymentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "additionalProperties": false
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payments.transfer"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "fromAccountId",
                    "toAccountId",
                    "amount",
                    "currency",
                    "effectiveAt",
                    "sourceFactId",
                    "evidence"
                  ],
                  "properties": {
                    "fromAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "toAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "amount": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]*$"
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 1
                    },
                    "receivedAmount": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]*$"
                    },
                    "receivedCurrency": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payments.unallocate"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "allocationId",
                    "sourceFactId",
                    "effectiveAt",
                    "evidence",
                    "allocations"
                  ],
                  "properties": {
                    "allocationId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "allocations": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "claimId",
                          "component",
                          "amount"
                        ],
                        "properties": {
                          "claimId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$"
                          },
                          "cashAmount": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$"
                          },
                          "component": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "originLedgerId",
                              "accountCode"
                            ],
                            "properties": {
                              "originLedgerId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "accountCode": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payroll.attribute_cost"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "attributionId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "statementId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "lineKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    },
                    "allocations": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 200,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "personPartyId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$",
                            "maxLength": 72
                          },
                          "month": {
                            "type": "string",
                            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                          }
                        },
                        "required": [
                          "amount"
                        ]
                      }
                    }
                  },
                  "required": [
                    "attributionId",
                    "statementId",
                    "lineKey",
                    "sourceFactId",
                    "evidence",
                    "allocations"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payroll.link_funding"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "paymentId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "purpose": {
                      "enum": [
                        "deposit",
                        "prefunding"
                      ]
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "paymentId",
                    "purpose",
                    "sourceFactId",
                    "evidence"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payroll.link_recorded_cost"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "linkId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "postingId": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "personPartyId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "providerPartyId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "kind": {
                      "enum": [
                        "pay",
                        "bonus",
                        "commission",
                        "employer_tax",
                        "benefits",
                        "reimbursement",
                        "fee",
                        "other"
                      ]
                    },
                    "month": {
                      "type": "string",
                      "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                    },
                    "nativeCost": {
                      "type": "object",
                      "additionalProperties": false,
                      "description": "Original invoice-currency expense amount, required for a translated posting. Use source evidence; the original event retains its frozen conversion rate.",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "amount": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]*)$",
                          "maxLength": 72
                        }
                      },
                      "required": [
                        "currency",
                        "amount"
                      ]
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "linkId",
                    "postingId",
                    "providerPartyId",
                    "kind",
                    "sourceFactId",
                    "evidence"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payroll.record_statement"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "statementId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "providerPartyId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "reference": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "total": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$",
                      "maxLength": 72
                    },
                    "invoiceDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "payrollDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "dueDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    },
                    "exchangeRate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "base",
                        "quote",
                        "date",
                        "numerator",
                        "denominator",
                        "evidence"
                      ],
                      "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                      "properties": {
                        "base": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "quote": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "numerator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "denominator": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "lines": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 200,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "lineKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512
                          },
                          "kind": {
                            "enum": [
                              "pay",
                              "bonus",
                              "commission",
                              "employer_tax",
                              "benefits",
                              "reimbursement",
                              "fee",
                              "other"
                            ]
                          },
                          "personPartyId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$",
                            "maxLength": 72
                          },
                          "month": {
                            "type": "string",
                            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                          },
                          "providerConversion": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "currency": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 512
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$",
                                "maxLength": 72
                              },
                              "exchangeRate": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "base",
                                  "quote",
                                  "date",
                                  "numerator",
                                  "denominator",
                                  "evidence"
                                ],
                                "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                "properties": {
                                  "base": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "quote": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "date": {
                                    "type": "string",
                                    "format": "date"
                                  },
                                  "numerator": {
                                    "type": "string",
                                    "pattern": "^[1-9][0-9]*$"
                                  },
                                  "denominator": {
                                    "type": "string",
                                    "pattern": "^[1-9][0-9]*$"
                                  },
                                  "evidence": {
                                    "type": "array",
                                    "minItems": 1,
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "kind",
                                        "ref"
                                      ],
                                      "properties": {
                                        "kind": {
                                          "enum": [
                                            "tap_message",
                                            "x402_receipt",
                                            "chain_tx",
                                            "signed_doc",
                                            "stripe_object",
                                            "other"
                                          ]
                                        },
                                        "ref": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "signer": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "required": [
                              "currency",
                              "amount"
                            ]
                          },
                          "performancePeriod": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "from": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "through": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              }
                            },
                            "required": [
                              "from",
                              "through"
                            ]
                          },
                          "approvedAt": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "approvalEvidence": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "kind",
                                "ref"
                              ],
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "tap_message",
                                    "x402_receipt",
                                    "chain_tx",
                                    "signed_doc",
                                    "stripe_object",
                                    "other"
                                  ]
                                },
                                "ref": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "signer": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            }
                          },
                          "expenseAccount": {
                            "type": "integer"
                          },
                          "expenseFunction": {
                            "enum": [
                              "cost_of_revenue",
                              "research_and_development",
                              "sales_and_marketing",
                              "general_and_administrative",
                              "other"
                            ]
                          }
                        },
                        "required": [
                          "lineKey",
                          "kind",
                          "amount",
                          "expenseAccount",
                          "expenseFunction"
                        ]
                      }
                    },
                    "liabilities": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "partyId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512
                          },
                          "accountCode": {
                            "enum": [
                              2110,
                              2170,
                              2171,
                              2172
                            ]
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$",
                            "maxLength": 72
                          }
                        },
                        "required": [
                          "partyId",
                          "accountCode",
                          "amount"
                        ]
                      }
                    }
                  },
                  "required": [
                    "statementId",
                    "providerPartyId",
                    "sourceFactId",
                    "currency",
                    "total",
                    "lines",
                    "evidence"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "payroll.reverse_statement"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "correctionId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "statementId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "reason": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    },
                    "costs": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 200,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "lineKey": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$",
                            "maxLength": 72
                          }
                        },
                        "required": [
                          "lineKey",
                          "amount"
                        ]
                      }
                    },
                    "liabilities": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 200,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "claimId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$",
                            "maxLength": 72
                          }
                        },
                        "required": [
                          "claimId",
                          "amount"
                        ]
                      }
                    }
                  },
                  "required": [
                    "correctionId",
                    "statementId",
                    "sourceFactId",
                    "reason",
                    "evidence"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "people.link_identity"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "identityId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "from": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "through": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    },
                    "expectedEventId": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "personPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "kind": {
                      "enum": [
                        "person",
                        "external",
                        "shared",
                        "agent"
                      ]
                    },
                    "vendorPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "accountId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "holder": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  },
                  "required": [
                    "identityId",
                    "from",
                    "sourceFactId",
                    "evidence",
                    "kind",
                    "vendorPartyId",
                    "accountId",
                    "holder"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "people.record_arrangement"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "arrangementId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "from": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "through": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    },
                    "expectedEventId": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "personPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "kind": {
                      "enum": [
                        "employee",
                        "contractor",
                        "peo",
                        "eor"
                      ]
                    },
                    "providerPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "employerPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "creditorPartyId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "contractId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "arrangementId",
                    "from",
                    "sourceFactId",
                    "evidence",
                    "personPartyId",
                    "kind"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "people.set_membership"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "membershipId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "from": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "through": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "sourceFactId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "evidence": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "kind",
                          "ref"
                        ],
                        "properties": {
                          "kind": {
                            "enum": [
                              "tap_message",
                              "x402_receipt",
                              "chain_tx",
                              "signed_doc",
                              "stripe_object",
                              "other"
                            ]
                          },
                          "ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "signer": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      }
                    },
                    "expectedEventId": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "partyId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "membershipId",
                    "from",
                    "sourceFactId",
                    "evidence",
                    "partyId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "presentation_rate.record"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "packageId",
                    "baseCurrency",
                    "quoteCurrency",
                    "numerator",
                    "denominator",
                    "observedAt",
                    "source"
                  ],
                  "properties": {
                    "packageId": {
                      "type": "string"
                    },
                    "baseCurrency": {
                      "type": "string"
                    },
                    "quoteCurrency": {
                      "type": "string"
                    },
                    "numerator": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]*$",
                      "maxLength": 38
                    },
                    "denominator": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]*$",
                      "maxLength": 38
                    },
                    "observedAt": {
                      "type": "string"
                    },
                    "source": {
                      "const": "manual_evidenced"
                    },
                    "approvedRate": {
                      "type": "object",
                      "description": "Copy the complete rate returned by fx_rate that the human reviewed. Required with lookupDate; provenance changes require review again.",
                      "required": [
                        "base",
                        "quote",
                        "requestedDate",
                        "date",
                        "numerator",
                        "denominator",
                        "source",
                        "settled"
                      ],
                      "properties": {
                        "base": {
                          "type": "string"
                        },
                        "quote": {
                          "type": "string"
                        },
                        "requestedDate": {
                          "type": "string"
                        },
                        "date": {
                          "type": "string"
                        },
                        "numerator": {
                          "type": "string"
                        },
                        "denominator": {
                          "type": "string"
                        },
                        "source": {
                          "const": "frankfurter"
                        },
                        "provider": {
                          "type": "string"
                        },
                        "settled": {
                          "type": "boolean"
                        }
                      }
                    },
                    "lookupDate": {
                      "type": "string",
                      "description": "Optional shared-store requested day (YYYY-MM-DD). First review fx_rate; the approved numerator, denominator and observation day must match. A human approval source_document remains required."
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "receipts.record"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "billing",
                    "payment"
                  ],
                  "properties": {
                    "processing": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "rail",
                        "netAmount",
                        "evidence"
                      ],
                      "properties": {
                        "rail": {
                          "enum": [
                            "ach",
                            "ach_same_day",
                            "fedwire",
                            "rtp",
                            "sepa",
                            "sepa_instant",
                            "swift",
                            "onchain",
                            "internal",
                            "card"
                          ]
                        },
                        "netAmount": {
                          "type": "string",
                          "pattern": "^(0|-?[1-9][0-9]*)$"
                        },
                        "feeFacts": {
                          "type": "object",
                          "maxProperties": 20,
                          "additionalProperties": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          }
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    },
                    "billing": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "contractId",
                        "activityKey",
                        "occurrenceKey",
                        "sourceFactId",
                        "effectiveAt",
                        "phase"
                      ],
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "obligationKey": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "obligationKey"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "period": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "through": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "from",
                                "through"
                              ]
                            }
                          },
                          "required": [
                            "period"
                          ]
                        }
                      ],
                      "properties": {
                        "contractId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "activityKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "occurrenceKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "obligationKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "sourceFactId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "effectiveAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "phase": {
                          "const": "billing"
                        },
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "exchangeRate": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "base",
                            "quote",
                            "date",
                            "numerator",
                            "denominator",
                            "evidence"
                          ],
                          "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                          "properties": {
                            "base": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "quote": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "date": {
                              "type": "string",
                              "format": "date"
                            },
                            "numerator": {
                              "type": "string",
                              "pattern": "^[1-9][0-9]*$"
                            },
                            "denominator": {
                              "type": "string",
                              "pattern": "^[1-9][0-9]*$"
                            },
                            "evidence": {
                              "type": "array",
                              "minItems": 1,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "ref"
                                ],
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "tap_message",
                                      "x402_receipt",
                                      "chain_tx",
                                      "signed_doc",
                                      "stripe_object",
                                      "other"
                                    ]
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        },
                        "period": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "from",
                            "through"
                          ],
                          "properties": {
                            "from": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "through": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        "facts": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "occurrenceId"
                                ],
                                "properties": {
                                  "occurrenceId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "claimId",
                                  "component"
                                ],
                                "properties": {
                                  "claimId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "component": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "originLedgerId",
                                      "accountCode"
                                    ],
                                    "properties": {
                                      "originLedgerId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "accountCode": {
                                        "type": "integer"
                                      }
                                    }
                                  }
                                }
                              }
                            ]
                          }
                        },
                        "evidence": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "billing": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "ref"
                                ],
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "tap_message",
                                      "x402_receipt",
                                      "chain_tx",
                                      "signed_doc",
                                      "stripe_object",
                                      "other"
                                    ]
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                }
                              }
                            },
                            "service": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "ref"
                                ],
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "tap_message",
                                      "x402_receipt",
                                      "chain_tx",
                                      "signed_doc",
                                      "stripe_object",
                                      "other"
                                    ]
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                }
                              }
                            },
                            "acceptance": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "ref"
                                ],
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "tap_message",
                                      "x402_receipt",
                                      "chain_tx",
                                      "signed_doc",
                                      "stripe_object",
                                      "other"
                                    ]
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                }
                              }
                            },
                            "economic": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "ref"
                                ],
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "tap_message",
                                      "x402_receipt",
                                      "chain_tx",
                                      "signed_doc",
                                      "stripe_object",
                                      "other"
                                    ]
                                  },
                                  "ref": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "signer": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "payment": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "financialAccountId",
                        "direction",
                        "amount",
                        "currency",
                        "partyId",
                        "effectiveAt",
                        "sourceFactId",
                        "evidence"
                      ],
                      "properties": {
                        "financialAccountId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "direction": {
                          "enum": [
                            "in",
                            "out"
                          ]
                        },
                        "amount": {
                          "type": "string",
                          "pattern": "^[1-9][0-9]*$"
                        },
                        "currency": {
                          "type": "string",
                          "minLength": 1
                        },
                        "partyId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "effectiveAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "sourceFactId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "evidence": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "ref"
                            ],
                            "properties": {
                              "kind": {
                                "enum": [
                                  "tap_message",
                                  "x402_receipt",
                                  "chain_tx",
                                  "signed_doc",
                                  "stripe_object",
                                  "other"
                                ]
                              },
                              "ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "signer": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "report_definitions.archive"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "report_definitions.pin"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                    },
                    "overview": {
                      "type": "boolean",
                      "default": false
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "report_definitions.publish"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                    },
                    "definition": {
                      "type": "object",
                      "description": "economico.report/1 has query and text blocks, and a query binds fixed params to ? in order. economico.report/2 adds parameters (bound by name, :month), layout, chart blocks, and width and caption on any block; its queries take no params.",
                      "properties": {
                        "spec": {
                          "enum": [
                            "economico.report/1",
                            "economico.report/2"
                          ]
                        },
                        "report_schema": {
                          "const": 1
                        },
                        "title": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "layout": {
                          "enum": [
                            "grid",
                            "document"
                          ],
                          "description": "Version 2. Default grid."
                        },
                        "parameters": {
                          "type": "array",
                          "maxItems": 8,
                          "description": "Version 2, in the order shown. A query binds :name; a month also gives :name_start, :name_end and :name_next, a date_range :name_from and :name_to. Every parameter has a default, so the report runs with nothing chosen.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,31}$"
                              },
                              "type": {
                                "enum": [
                                  "month",
                                  "date",
                                  "date_range",
                                  "choice",
                                  "integer"
                                ]
                              },
                              "label": {
                                "type": "string"
                              },
                              "default": {
                                "description": "month: last_complete_month, this_month or YYYY-MM. date: today or YYYY-MM-DD. date_range: last_12_months, year_to_date, last_complete_month or {from, to}. choice: one of its option values. integer: a whole number from min to max."
                              },
                              "options": {
                                "type": "array",
                                "description": "choice only.",
                                "maxItems": 50,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "value",
                                    "label"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "min": {
                                "type": "integer",
                                "description": "integer only."
                              },
                              "max": {
                                "type": "integer",
                                "description": "integer only."
                              }
                            },
                            "required": [
                              "name",
                              "type",
                              "label",
                              "default"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "blocks": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 12,
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "const": "query"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "sql": {
                                    "type": "string"
                                  },
                                  "params": {
                                    "type": "array",
                                    "description": "Version 1 only. Fixed bindings: text, safe integers or null. Fractions belong in SQL, or bind decimal text and CAST it.",
                                    "items": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "width": {
                                    "enum": [
                                      "full",
                                      "half",
                                      "third"
                                    ],
                                    "description": "Version 2. Default full."
                                  },
                                  "caption": {
                                    "type": "string",
                                    "description": "One line under the block, e.g. booked or recognised."
                                  }
                                },
                                "required": [
                                  "type",
                                  "title",
                                  "sql"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "const": "text"
                                  },
                                  "markdown": {
                                    "type": "string"
                                  },
                                  "width": {
                                    "enum": [
                                      "full",
                                      "half",
                                      "third"
                                    ],
                                    "description": "Version 2. Default full."
                                  },
                                  "caption": {
                                    "type": "string",
                                    "description": "One line under the block, e.g. booked or recognised."
                                  }
                                },
                                "required": [
                                  "type",
                                  "markdown"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "description": "Version 2. Draws the query's rows: x along the bottom (months, dates or names), y one column for a bar chart or a list of up to four for a line chart. Money y columns (*_minor) need currency selected beside them and draw one chart per currency.",
                                "properties": {
                                  "type": {
                                    "const": "chart"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "sql": {
                                    "type": "string"
                                  },
                                  "mark": {
                                    "enum": [
                                      "bar",
                                      "line"
                                    ]
                                  },
                                  "x": {
                                    "type": "string"
                                  },
                                  "y": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        },
                                        "minItems": 1,
                                        "maxItems": 4
                                      }
                                    ]
                                  },
                                  "width": {
                                    "enum": [
                                      "full",
                                      "half",
                                      "third"
                                    ],
                                    "description": "Version 2. Default full."
                                  },
                                  "caption": {
                                    "type": "string",
                                    "description": "One line under the block, e.g. booked or recognised."
                                  }
                                },
                                "required": [
                                  "type",
                                  "title",
                                  "sql",
                                  "mark",
                                  "x",
                                  "y"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        }
                      },
                      "required": [
                        "spec",
                        "report_schema",
                        "title",
                        "blocks"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "definition"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "report_definitions.unpin"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "reporting_adjustment.post"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "packageId",
                    "requirement",
                    "description",
                    "currency",
                    "lines"
                  ],
                  "properties": {
                    "packageId": {
                      "type": "string"
                    },
                    "requirement": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 1024
                    },
                    "currency": {
                      "type": "string"
                    },
                    "lines": {
                      "type": "array",
                      "minItems": 2,
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "required": [
                          "accountCode",
                          "direction",
                          "amount"
                        ],
                        "properties": {
                          "accountCode": {
                            "type": "integer"
                          },
                          "direction": {
                            "enum": [
                              "debit",
                              "credit"
                            ]
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]*)$"
                          },
                          "subKey": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "enum": [
                                  0,
                                  1,
                                  2,
                                  3,
                                  4,
                                  5,
                                  6
                                ]
                              },
                              "symbol": {
                                "type": "string"
                              },
                              "partyId": {
                                "type": "string"
                              },
                              "sku": {
                                "type": "string"
                              },
                              "financialAccountId": {
                                "type": "string"
                              },
                              "taxCodeId": {
                                "type": "string"
                              },
                              "expenseFunction": {
                                "enum": [
                                  "cost_of_revenue",
                                  "research_and_development",
                                  "sales_and_marketing",
                                  "general_and_administrative",
                                  "other"
                                ]
                              }
                            }
                          },
                          "asset": {
                            "type": "string"
                          },
                          "assetAmount": {
                            "type": "string"
                          },
                          "externalId": {
                            "type": "string",
                            "maxLength": 200
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "reporting_adjustment.void"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "eventId"
                  ],
                  "properties": {
                    "eventId": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "reason": {
                      "type": "string",
                      "maxLength": 200
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "reporting_profile.select"
                },
                "input": {
                  "type": "object",
                  "required": [
                    "packageId",
                    "jurisdiction",
                    "legalEntityScope",
                    "framework",
                    "frameworkEdition",
                    "policyElections"
                  ],
                  "properties": {
                    "packageId": {
                      "type": "string"
                    },
                    "jurisdiction": {
                      "type": "string"
                    },
                    "legalEntityScope": {
                      "type": "string"
                    },
                    "framework": {
                      "type": "string"
                    },
                    "frameworkEdition": {
                      "type": "string"
                    },
                    "policyElections": {
                      "type": "array",
                      "maxItems": 32,
                      "items": {
                        "type": "string"
                      }
                    },
                    "overrides": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "required": [
                          "ruleId",
                          "destination"
                        ],
                        "properties": {
                          "ruleId": {
                            "type": "string"
                          },
                          "destination": {
                            "type": "object",
                            "required": [
                              "code",
                              "label",
                              "reportLineIds"
                            ],
                            "properties": {
                              "code": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "reportLineIds": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 32,
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "shared_views.create"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "description": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "mode": {
                      "enum": [
                        "live",
                        "frozen"
                      ],
                      "default": "frozen"
                    },
                    "definitions": {
                      "type": "array",
                      "maxItems": 12,
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "params": {
                            "type": "object",
                            "description": "Frozen links only: the values to capture the report with, by parameter name (a month as YYYY-MM, a range as name_from and name_to). Absent, its defaults on the day the link is made. A live link's viewer chooses within the report's bounds.",
                            "additionalProperties": {
                              "type": [
                                "string",
                                "integer"
                              ]
                            }
                          }
                        },
                        "required": [
                          "id",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "reports": {
                      "type": "array",
                      "items": {
                        "enum": [
                          "activity_balances",
                          "activity_claims",
                          "pipeline",
                          "activity_effects",
                          "balances",
                          "balance_sheet",
                          "capital_accounts",
                          "income_statement",
                          "income_statement_periods",
                          "recognition",
                          "amortization",
                          "aging",
                          "unit_economics",
                          "cap_table"
                        ]
                      },
                      "uniqueItems": true
                    },
                    "documents": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "uniqueItems": true
                    },
                    "contracts": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "uniqueItems": true
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 16
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "description"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "shared_views.revoke"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "viewId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "viewId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "subscription.cancel_request"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "maxLength": 500
                    }
                  },
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "subscription.revoke_cancellation"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "cancellationId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "cancellationId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "tax_codes.create"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "taxCodeId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "code": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "role": {
                      "enum": [
                        "output",
                        "input",
                        "reverse_charge",
                        "imported_services",
                        "non_recoverable"
                      ],
                      "default": "output",
                      "description": "How the code posts: output credits 2160; input debits recoverable 1170; reverse_charge and imported_services debit 1170 and credit 2165; non_recoverable tax is added to the expense."
                    },
                    "ratePpm": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000,
                      "description": "Rate in parts per million: 50000 means 5%, 99750 means 9.975%."
                    },
                    "effectiveFrom": {
                      "type": "string",
                      "format": "date",
                      "description": "First day the rate applies; omit for no lower bound."
                    },
                    "effectiveUntil": {
                      "type": "string",
                      "format": "date",
                      "description": "First day the rate no longer applies (exclusive); omit for open-ended."
                    }
                  },
                  "required": [
                    "taxCodeId",
                    "code",
                    "name",
                    "ratePpm"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "tax_codes.update"
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "taxCodeId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "ratePpm": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000,
                      "description": "Rate in parts per million: 50000 means 5%, 99750 means 9.975%."
                    },
                    "effectiveUntil": {
                      "type": "string",
                      "format": "date",
                      "description": "First day the rate no longer applies (exclusive); omit for open-ended."
                    },
                    "active": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "taxCodeId"
                  ],
                  "additionalProperties": false
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "templates.archive"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "id",
                    "expectedDocumentId"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind activity, template that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "templates.create"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "definition": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "vendorPlan": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "catalog": {
                              "type": "string"
                            },
                            "cid": {
                              "type": "string"
                            },
                            "template": {
                              "type": "string"
                            },
                            "relation": {
                              "enum": [
                                "adopted",
                                "derived"
                              ]
                            }
                          },
                          "required": [
                            "cid",
                            "template",
                            "relation"
                          ]
                        },
                        "lifecycle": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "term": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "index": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 9007199254740991
                                },
                                "startsOn": {
                                  "type": "string",
                                  "minLength": 1,
                                  "format": "date",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "endsOn": {
                                  "type": "string",
                                  "minLength": 1,
                                  "format": "date",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "rolling": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyMonths": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 120
                                        }
                                      },
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyDays": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 3660
                                        }
                                      },
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "index",
                                "startsOn"
                              ]
                            },
                            "atTermEnd": {
                              "enum": [
                                "renew",
                                "evergreen",
                                "end",
                                "renew_once"
                              ]
                            },
                            "renewal": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "length": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyMonths": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 120
                                        }
                                      },
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyDays": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 3660
                                        }
                                      },
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                },
                                "price": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "enum": [
                                            "same",
                                            "list"
                                          ]
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "uplift"
                                        },
                                        "bps": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000
                                        },
                                        "terms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "bps",
                                        "terms"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped"
                                        },
                                        "bps": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000
                                        },
                                        "terms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "uncappedWhen": {
                                          "type": "array",
                                          "items": {
                                            "enum": [
                                              "quantity_reduced",
                                              "term_shortened"
                                            ]
                                          },
                                          "maxItems": 2,
                                          "minItems": 0
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "bps",
                                        "terms"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "price"
                              ]
                            },
                            "notice": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "days": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 366
                                },
                                "basis": {
                                  "enum": [
                                    "calendar",
                                    "weekdays"
                                  ]
                                },
                                "remindDaysBefore": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 366
                                }
                              },
                              "required": [
                                "days",
                                "basis"
                              ]
                            },
                            "cancellation": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "windows": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "from": {
                                        "enum": [
                                          "term_start",
                                          "term_end"
                                        ]
                                      },
                                      "days": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 366
                                      }
                                    },
                                    "required": [
                                      "from",
                                      "days"
                                    ]
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                },
                                "onlyInWindows": {
                                  "const": true
                                },
                                "otherwise": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "none"
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "fee"
                                        },
                                        "right": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "right"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "accelerate"
                                        },
                                        "rights": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "rights"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "windows",
                                "otherwise"
                              ]
                            },
                            "changes": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "termsChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "on_posting"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "next_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "locked_to_order"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "objection_until_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                },
                                "priceChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "no_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "held_for_paid_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped_at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "capPpm": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 10000000
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "capPpm"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "mid_term_credit"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": []
                            }
                          },
                          "required": [
                            "term",
                            "atTermEnd",
                            "notice"
                          ]
                        },
                        "agreements": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "changes": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "termsChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "on_posting"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "next_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "locked_to_order"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "objection_until_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                },
                                "priceChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "no_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "held_for_paid_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped_at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "capPpm": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 10000000
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "capPpm"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "mid_term_credit"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": []
                            },
                            "refs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "role": {
                                    "enum": [
                                      "agreement",
                                      "order_form",
                                      "schedule",
                                      "policy"
                                    ]
                                  },
                                  "url": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "uri",
                                    "maxLength": 2048
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cid": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "method": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "kind": {
                                        "enum": [
                                          "pdf",
                                          "markdown",
                                          "html",
                                          "html_blanked",
                                          "html_extract",
                                          "embedded_json",
                                          "api_json",
                                          "text_render",
                                          "unstable"
                                        ]
                                      },
                                      "command": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 1000
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ]
                                  },
                                  "seenAt": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "history": {
                                    "enum": [
                                      "vendor_archive",
                                      "git",
                                      "wayback"
                                    ]
                                  },
                                  "catalog": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "cid": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "cid"
                                    ]
                                  },
                                  "documentId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "key",
                                  "role",
                                  "url",
                                  "method",
                                  "seenAt"
                                ]
                              },
                              "maxItems": 20,
                              "minItems": 1
                            },
                            "precedence": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "stated": {
                                  "type": "boolean"
                                },
                                "order": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                },
                                "orderFormWinsOn": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                }
                              },
                              "required": [
                                "stated"
                              ]
                            }
                          },
                          "required": [
                            "refs",
                            "precedence"
                          ]
                        },
                        "model": {
                          "const": "priced-rights-v1"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "plan": {
                          "enum": [
                            "on_sale",
                            "off_sale"
                          ]
                        },
                        "parties": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          },
                          "minItems": 1,
                          "maxItems": 100
                        },
                        "partyCategories": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "enum": [
                                "customer",
                                "vendor",
                                "founder",
                                "investor",
                                "provider",
                                "employee"
                              ]
                            },
                            "minItems": 0,
                            "maxItems": 6
                          }
                        },
                        "ledgers": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "classification": {
                                "enum": [
                                  "gaap",
                                  "contractual",
                                  "operational",
                                  "ownership",
                                  "planning"
                                ]
                              },
                              "unitKind": {
                                "enum": [
                                  "currency",
                                  "share",
                                  "usage",
                                  "credit",
                                  "right",
                                  "token",
                                  "other"
                                ]
                              },
                              "unitCode": {
                                "type": "string",
                                "minLength": 1
                              },
                              "decimals": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 18
                              },
                              "accountTemplate": {
                                "enum": [
                                  "gaap_startup",
                                  "contract_flow",
                                  "capacity",
                                  "meter",
                                  "entitlement",
                                  "issued_instrument"
                                ]
                              }
                            },
                            "required": [
                              "classification",
                              "unitKind",
                              "unitCode",
                              "decimals",
                              "accountTemplate"
                            ]
                          }
                        },
                        "activities": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "activityDocumentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "partyRole": {
                                "type": "string",
                                "minLength": 1
                              },
                              "ledgers": {
                                "type": "object",
                                "maxProperties": 100,
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "terms": {
                                "type": "object",
                                "maxProperties": 100,
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            },
                            "required": [
                              "key",
                              "activityDocumentId",
                              "partyRole"
                            ]
                          },
                          "minItems": 1,
                          "maxItems": 100
                        },
                        "consequences": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "sourceRights": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "minItems": 1,
                                "maxItems": 100
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "grant_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "expiresAtTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger",
                                      "quantity",
                                      "expiresAtTerm"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "consume_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantOccurrenceFact": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "overageRight": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger",
                                      "quantity",
                                      "grantOccurrenceFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "expire_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "valueLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "minimum"
                                      },
                                      "eligibleRights": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "minItems": 1,
                                        "maxItems": 100
                                      },
                                      "minimum": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "currencyTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "eligibleRights",
                                      "minimum",
                                      "currencyTerm",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "refund_unearned"
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "taxClaimFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "profit_allocation"
                                      },
                                      "result": {
                                        "enum": [
                                          "profit",
                                          "loss"
                                        ]
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "ownershipLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "ownershipLedger",
                                      "amount",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "profit_allocation"
                                      },
                                      "result": {
                                        "enum": [
                                          "profit",
                                          "loss"
                                        ]
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "ownershipBasis": {
                                        "const": "agreement"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "ownershipBasis",
                                      "amount",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "close_draws"
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "authorize_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "issue_units"
                                      },
                                      "capitalAllocation": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "shareCapital": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          },
                                          "sharePremium": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          }
                                        },
                                        "required": [
                                          "shareCapital",
                                          "sharePremium"
                                        ]
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      },
                                      "restricted": {
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "consideration",
                                      "restricted"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "capital_contribution"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "consideration"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "financing_commitment"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      },
                                      "liability": {
                                        "const": "owner_advance"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "consideration"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "capital_distribution"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "owner_draw"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "vest_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantOccurrenceFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "grantOccurrenceFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "vest_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantConsequence": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "grantConsequence"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "convert_claim"
                                      },
                                      "claimFact": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "currencyTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "equityAccount": {
                                        "enum": [
                                          3100,
                                          3110,
                                          3120
                                        ]
                                      },
                                      "units": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "ledger": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "quantity": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          },
                                          "restricted": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "ledger",
                                          "quantity",
                                          "restricted"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "claimFact",
                                      "amount",
                                      "currencyTerm",
                                      "monetaryLedger",
                                      "equityAccount"
                                    ]
                                  }
                                ]
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "transition"
                                      },
                                      "action": {
                                        "enum": [
                                          "accept",
                                          "cancel",
                                          "terminate"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "action"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "exercise"
                                      },
                                      "activityKey": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "activityKey"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "period_close"
                                      },
                                      "schedule": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "startTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "anchorTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "endTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "everyMonths": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "timing": {
                                            "enum": [
                                              "start",
                                              "end"
                                            ]
                                          },
                                          "offsetDays": {
                                            "type": "integer",
                                            "minimum": -365,
                                            "maximum": 365
                                          },
                                          "serviceEvidence": {
                                            "const": "elapsed_time"
                                          }
                                        },
                                        "required": [
                                          "startTerm",
                                          "everyMonths",
                                          "timing",
                                          "offsetDays"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "schedule"
                                    ]
                                  }
                                ]
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "acceptance",
                                    "economic",
                                    "service"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 100
                              }
                            },
                            "required": [
                              "key",
                              "sourceRights",
                              "trigger",
                              "rule",
                              "evidence"
                            ]
                          },
                          "minItems": 0,
                          "maxItems": 100
                        },
                        "creditPools": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "lots": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "right": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "eligibleRights": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "minItems": 1,
                                      "maxItems": 100
                                    }
                                  },
                                  "required": [
                                    "right",
                                    "eligibleRights"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 20
                              },
                              "drawAt": {
                                "enum": [
                                  "recognition",
                                  "billing"
                                ]
                              },
                              "drawOrder": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "expiry",
                                    "granted_first",
                                    "bought_first",
                                    "narrowest_scope",
                                    "oldest"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 5
                              }
                            },
                            "required": [
                              "key",
                              "lots",
                              "drawAt",
                              "drawOrder"
                            ]
                          },
                          "minItems": 1,
                          "maxItems": 20
                        }
                      },
                      "required": [
                        "model",
                        "name",
                        "parties",
                        "activities"
                      ]
                    }
                  },
                  "required": [
                    "definition"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind activity, template, contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            },
            {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "object",
              "properties": {
                "name": {
                  "const": "templates.replace"
                },
                "input": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedDocumentId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "definition": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "vendorPlan": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "catalog": {
                              "type": "string"
                            },
                            "cid": {
                              "type": "string"
                            },
                            "template": {
                              "type": "string"
                            },
                            "relation": {
                              "enum": [
                                "adopted",
                                "derived"
                              ]
                            }
                          },
                          "required": [
                            "cid",
                            "template",
                            "relation"
                          ]
                        },
                        "lifecycle": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "term": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "index": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 9007199254740991
                                },
                                "startsOn": {
                                  "type": "string",
                                  "minLength": 1,
                                  "format": "date",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "endsOn": {
                                  "type": "string",
                                  "minLength": 1,
                                  "format": "date",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "rolling": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyMonths": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 120
                                        }
                                      },
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyDays": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 3660
                                        }
                                      },
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "index",
                                "startsOn"
                              ]
                            },
                            "atTermEnd": {
                              "enum": [
                                "renew",
                                "evergreen",
                                "end",
                                "renew_once"
                              ]
                            },
                            "renewal": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "length": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyMonths": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 120
                                        }
                                      },
                                      "required": [
                                        "everyMonths"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "everyDays": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 3660
                                        }
                                      },
                                      "required": [
                                        "everyDays"
                                      ]
                                    }
                                  ]
                                },
                                "price": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "enum": [
                                            "same",
                                            "list"
                                          ]
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "uplift"
                                        },
                                        "bps": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000
                                        },
                                        "terms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "bps",
                                        "terms"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped"
                                        },
                                        "bps": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000
                                        },
                                        "terms": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "term": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "term"
                                            ]
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "uncappedWhen": {
                                          "type": "array",
                                          "items": {
                                            "enum": [
                                              "quantity_reduced",
                                              "term_shortened"
                                            ]
                                          },
                                          "maxItems": 2,
                                          "minItems": 0
                                        },
                                        "reducedLosesPrice": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "quantityTerms": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "term": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "right",
                                                  "term"
                                                ]
                                              },
                                              "maxItems": 100,
                                              "minItems": 1
                                            }
                                          },
                                          "required": [
                                            "quantityTerms"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "bps",
                                        "terms"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "price"
                              ]
                            },
                            "notice": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "days": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 366
                                },
                                "basis": {
                                  "enum": [
                                    "calendar",
                                    "weekdays"
                                  ]
                                },
                                "remindDaysBefore": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 366
                                }
                              },
                              "required": [
                                "days",
                                "basis"
                              ]
                            },
                            "cancellation": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "windows": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "from": {
                                        "enum": [
                                          "term_start",
                                          "term_end"
                                        ]
                                      },
                                      "days": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 366
                                      }
                                    },
                                    "required": [
                                      "from",
                                      "days"
                                    ]
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                },
                                "onlyInWindows": {
                                  "const": true
                                },
                                "otherwise": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "none"
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "fee"
                                        },
                                        "right": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "right"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "type": {
                                          "const": "accelerate"
                                        },
                                        "rights": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "maxItems": 100,
                                          "minItems": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "rights"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "windows",
                                "otherwise"
                              ]
                            },
                            "changes": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "termsChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "on_posting"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "next_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "locked_to_order"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "objection_until_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                },
                                "priceChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "no_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "held_for_paid_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped_at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "capPpm": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 10000000
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "capPpm"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "mid_term_credit"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": []
                            }
                          },
                          "required": [
                            "term",
                            "atTermEnd",
                            "notice"
                          ]
                        },
                        "agreements": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "changes": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "termsChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "on_posting"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "next_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "locked_to_order"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "objection_until_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                },
                                "priceChange": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "no_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "after_notice"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "held_for_paid_term"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "noticeDays": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 366
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "noticeDays"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "capped_at_renewal"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "capPpm": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 10000000
                                        },
                                        "index": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule",
                                        "capPpm"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "rule": {
                                          "const": "mid_term_credit"
                                        },
                                        "from": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "rule"
                                      ]
                                    }
                                  ]
                                }
                              },
                              "required": []
                            },
                            "refs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "role": {
                                    "enum": [
                                      "agreement",
                                      "order_form",
                                      "schedule",
                                      "policy"
                                    ]
                                  },
                                  "url": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "uri",
                                    "maxLength": 2048
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cid": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "method": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "kind": {
                                        "enum": [
                                          "pdf",
                                          "markdown",
                                          "html",
                                          "html_blanked",
                                          "html_extract",
                                          "embedded_json",
                                          "api_json",
                                          "text_render",
                                          "unstable"
                                        ]
                                      },
                                      "command": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 1000
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ]
                                  },
                                  "seenAt": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "history": {
                                    "enum": [
                                      "vendor_archive",
                                      "git",
                                      "wayback"
                                    ]
                                  },
                                  "catalog": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "cid": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "cid"
                                    ]
                                  },
                                  "documentId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "key",
                                  "role",
                                  "url",
                                  "method",
                                  "seenAt"
                                ]
                              },
                              "maxItems": 20,
                              "minItems": 1
                            },
                            "precedence": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "stated": {
                                  "type": "boolean"
                                },
                                "order": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                },
                                "orderFormWinsOn": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "maxItems": 20,
                                  "minItems": 0
                                }
                              },
                              "required": [
                                "stated"
                              ]
                            }
                          },
                          "required": [
                            "refs",
                            "precedence"
                          ]
                        },
                        "model": {
                          "const": "priced-rights-v1"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "plan": {
                          "enum": [
                            "on_sale",
                            "off_sale"
                          ]
                        },
                        "parties": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          },
                          "minItems": 1,
                          "maxItems": 100
                        },
                        "partyCategories": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "enum": [
                                "customer",
                                "vendor",
                                "founder",
                                "investor",
                                "provider",
                                "employee"
                              ]
                            },
                            "minItems": 0,
                            "maxItems": 6
                          }
                        },
                        "ledgers": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "classification": {
                                "enum": [
                                  "gaap",
                                  "contractual",
                                  "operational",
                                  "ownership",
                                  "planning"
                                ]
                              },
                              "unitKind": {
                                "enum": [
                                  "currency",
                                  "share",
                                  "usage",
                                  "credit",
                                  "right",
                                  "token",
                                  "other"
                                ]
                              },
                              "unitCode": {
                                "type": "string",
                                "minLength": 1
                              },
                              "decimals": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 18
                              },
                              "accountTemplate": {
                                "enum": [
                                  "gaap_startup",
                                  "contract_flow",
                                  "capacity",
                                  "meter",
                                  "entitlement",
                                  "issued_instrument"
                                ]
                              }
                            },
                            "required": [
                              "classification",
                              "unitKind",
                              "unitCode",
                              "decimals",
                              "accountTemplate"
                            ]
                          }
                        },
                        "activities": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "activityDocumentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "partyRole": {
                                "type": "string",
                                "minLength": 1
                              },
                              "ledgers": {
                                "type": "object",
                                "maxProperties": 100,
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "terms": {
                                "type": "object",
                                "maxProperties": 100,
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            },
                            "required": [
                              "key",
                              "activityDocumentId",
                              "partyRole"
                            ]
                          },
                          "minItems": 1,
                          "maxItems": 100
                        },
                        "consequences": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "sourceRights": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "minItems": 1,
                                "maxItems": 100
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "grant_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "expiresAtTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger",
                                      "quantity",
                                      "expiresAtTerm"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "consume_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantOccurrenceFact": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "overageRight": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger",
                                      "quantity",
                                      "grantOccurrenceFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "expire_capacity"
                                      },
                                      "capacityLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "valueLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "capacityLedger"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "minimum"
                                      },
                                      "eligibleRights": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "minItems": 1,
                                        "maxItems": 100
                                      },
                                      "minimum": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "currencyTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "eligibleRights",
                                      "minimum",
                                      "currencyTerm",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "refund_unearned"
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "taxClaimFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "profit_allocation"
                                      },
                                      "result": {
                                        "enum": [
                                          "profit",
                                          "loss"
                                        ]
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "ownershipLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "ownershipLedger",
                                      "amount",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "profit_allocation"
                                      },
                                      "result": {
                                        "enum": [
                                          "profit",
                                          "loss"
                                        ]
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "ownershipBasis": {
                                        "const": "agreement"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "ownershipBasis",
                                      "amount",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "close_draws"
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "completeThroughFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "monetaryLedger",
                                      "completeThroughFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "authorize_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "issue_units"
                                      },
                                      "capitalAllocation": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "shareCapital": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          },
                                          "sharePremium": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          }
                                        },
                                        "required": [
                                          "shareCapital",
                                          "sharePremium"
                                        ]
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      },
                                      "restricted": {
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "consideration",
                                      "restricted"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "capital_contribution"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "consideration"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "financing_commitment"
                                      },
                                      "consideration": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "money"
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "recognition": {
                                                "enum": [
                                                  "unconditional_obligation",
                                                  "condition_satisfied"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "amount",
                                              "currencyTerm",
                                              "recognition"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "units"
                                              },
                                              "quantity": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "ledger": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "quantity",
                                              "ledger"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "claim"
                                              },
                                              "claimFact": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "amount": {
                                                "type": "string",
                                                "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                              },
                                              "currencyTerm": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "claimFact",
                                              "amount",
                                              "currencyTerm"
                                            ]
                                          }
                                        ]
                                      },
                                      "liability": {
                                        "const": "owner_advance"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "consideration"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "capital_distribution"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "owner_draw"
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "amount"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "vest_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantOccurrenceFact": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "grantOccurrenceFact"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "vest_units"
                                      },
                                      "unitsLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "quantity": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "grantConsequence": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "unitsLedger",
                                      "quantity",
                                      "grantConsequence"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "convert_claim"
                                      },
                                      "claimFact": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                      },
                                      "currencyTerm": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "monetaryLedger": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "equityAccount": {
                                        "enum": [
                                          3100,
                                          3110,
                                          3120
                                        ]
                                      },
                                      "units": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "ledger": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "quantity": {
                                            "type": "string",
                                            "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                          },
                                          "restricted": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "ledger",
                                          "quantity",
                                          "restricted"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "claimFact",
                                      "amount",
                                      "currencyTerm",
                                      "monetaryLedger",
                                      "equityAccount"
                                    ]
                                  }
                                ]
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "transition"
                                      },
                                      "action": {
                                        "enum": [
                                          "accept",
                                          "cancel",
                                          "terminate"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "action"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "exercise"
                                      },
                                      "activityKey": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "activityKey"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "const": "period_close"
                                      },
                                      "schedule": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "startTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "anchorTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "endTerm": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "everyMonths": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "timing": {
                                            "enum": [
                                              "start",
                                              "end"
                                            ]
                                          },
                                          "offsetDays": {
                                            "type": "integer",
                                            "minimum": -365,
                                            "maximum": 365
                                          },
                                          "serviceEvidence": {
                                            "const": "elapsed_time"
                                          }
                                        },
                                        "required": [
                                          "startTerm",
                                          "everyMonths",
                                          "timing",
                                          "offsetDays"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "schedule"
                                    ]
                                  }
                                ]
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "acceptance",
                                    "economic",
                                    "service"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 100
                              }
                            },
                            "required": [
                              "key",
                              "sourceRights",
                              "trigger",
                              "rule",
                              "evidence"
                            ]
                          },
                          "minItems": 0,
                          "maxItems": 100
                        },
                        "creditPools": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "lots": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "right": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "eligibleRights": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "minItems": 1,
                                      "maxItems": 100
                                    }
                                  },
                                  "required": [
                                    "right",
                                    "eligibleRights"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 20
                              },
                              "drawAt": {
                                "enum": [
                                  "recognition",
                                  "billing"
                                ]
                              },
                              "drawOrder": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "expiry",
                                    "granted_first",
                                    "bought_first",
                                    "narrowest_scope",
                                    "oldest"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 5
                              }
                            },
                            "required": [
                              "key",
                              "lots",
                              "drawAt",
                              "drawOrder"
                            ]
                          },
                          "minItems": 1,
                          "maxItems": 20
                        }
                      },
                      "required": [
                        "model",
                        "name",
                        "parties",
                        "activities"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "expectedDocumentId",
                    "definition"
                  ]
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "effective_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source_document_id": {
                  "description": "A registered document of kind activity, template, contract, source_document that caused this command.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "name",
                "input",
                "idempotency_key",
                "effective_at"
              ],
              "additionalProperties": false
            }
          ]
        },
        "examples": {
          "accounts.archive.0": {
            "value": {
              "name": "accounts.archive",
              "input": {
                "financialAccountId": "fa_example_bank"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "accounts.archive-example-0"
            }
          },
          "accounts.register.0": {
            "value": {
              "name": "accounts.register",
              "input": {
                "financialAccountId": "fa_example_bank",
                "name": "Operating bank",
                "currency": "USD",
                "kind": "checking"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "accounts.register-example-0"
            }
          },
          "accounts.register.1": {
            "value": {
              "name": "accounts.register",
              "input": {
                "financialAccountId": "card_founder_visa_4242",
                "name": "Founder's Visa ending 4242",
                "currency": "USD",
                "kind": "card",
                "ownerPartyId": "founder_ada"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "accounts.register-example-1"
            }
          },
          "accounts.restore.0": {
            "value": {
              "name": "accounts.restore",
              "input": {
                "financialAccountId": "fa_example_bank"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "accounts.restore-example-0"
            }
          },
          "accounts.set_opening_balance.0": {
            "value": {
              "name": "accounts.set_opening_balance",
              "input": {
                "financialAccountId": "fa_example_bank",
                "openingBalance": "125000",
                "openingDate": "2026-07-01"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "accounts.set_opening_balance-example-0"
            }
          },
          "accounts.update.0": {
            "value": {
              "name": "accounts.update",
              "input": {
                "financialAccountId": "fa_example_bank",
                "name": "Main operating bank"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "accounts.update-example-0"
            }
          },
          "activities.archive.0": {
            "value": {
              "name": "activities.archive",
              "input": {
                "id": "activity_example",
                "expectedDocumentId": "doc_current"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "activities.archive-example-0"
            }
          },
          "activities.create.0": {
            "value": {
              "name": "activities.create",
              "input": {
                "definition": {
                  "model": "priced-rights-v1",
                  "name": "Consulting access",
                  "price": {
                    "treatment": "free",
                    "evidence": [
                      {
                        "kind": "other",
                        "ref": "signed-free-access"
                      }
                    ]
                  },
                  "economics": {
                    "kind": "service",
                    "direction": "provide"
                  }
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "activities.create-example-0"
            }
          },
          "activities.replace.0": {
            "value": {
              "name": "activities.replace",
              "input": {
                "id": "activity_example",
                "expectedDocumentId": "doc_previous",
                "definition": {
                  "model": "priced-rights-v1",
                  "name": "Consulting access",
                  "price": {
                    "treatment": "free",
                    "evidence": [
                      {
                        "kind": "other",
                        "ref": "signed-free-access"
                      }
                    ]
                  },
                  "economics": {
                    "kind": "service",
                    "direction": "provide"
                  }
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "activities.replace-example-0"
            }
          },
          "business.change_fiscal_year.0": {
            "value": {
              "name": "business.change_fiscal_year",
              "input": {
                "yearEnd": "06-30",
                "reason": "Align with the academic-year customer cycle"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.change_fiscal_year-example-0"
            }
          },
          "business.change_functional_currency.0": {
            "value": {
              "name": "business.change_functional_currency",
              "input": {
                "fromCurrency": "USD",
                "toCurrency": "CHF",
                "reason": "USD was chosen at signup by mistake; the business is Swiss"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.change_functional_currency-example-0"
            }
          },
          "business.change_legal_form.0": {
            "value": {
              "name": "business.change_legal_form",
              "input": {
                "jurisdiction": "CA-ON",
                "legalEntityType": "corporation",
                "reason": "Continued from Delaware into Ontario under the OBCA"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.change_legal_form-example-0"
            }
          },
          "business.change_legal_form.1": {
            "value": {
              "name": "business.change_legal_form",
              "input": {
                "legalEntityType": "llc",
                "reason": "Statutory conversion to a Delaware LLC"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.change_legal_form-example-1"
            }
          },
          "business.change_legal_name.0": {
            "value": {
              "name": "business.change_legal_name",
              "input": {
                "name": "Acme Robotics, Inc.",
                "reason": "Certificate of amendment filed with the Delaware Division of Corporations"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.change_legal_name-example-0"
            }
          },
          "business.deregister_sales_tax.0": {
            "value": {
              "name": "business.deregister_sales_tax",
              "input": {
                "regime": "gb_vat",
                "effectiveUntil": "2027-04-01",
                "reason": "HMRC cancelled the VAT registration below the threshold"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.deregister_sales_tax-example-0"
            }
          },
          "business.elect_accounting_framework.0": {
            "value": {
              "name": "business.elect_accounting_framework",
              "input": {
                "framework": "us_gaap",
                "reason": "Board resolution adopting US GAAP"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.elect_accounting_framework-example-0"
            }
          },
          "business.elect_accounting_framework.1": {
            "value": {
              "name": "business.elect_accounting_framework",
              "input": {
                "framework": "uk_frs_105",
                "edition": "September 2024",
                "sizeEligibility": {
                  "basis": "Companies Act 2006 s384A micro-entity conditions met in FY2025 and FY2026",
                  "periodEnd": "2026-12-31"
                },
                "reason": "Directors elected the micro-entities regime"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.elect_accounting_framework-example-1"
            }
          },
          "business.incorporate.0": {
            "value": {
              "name": "business.incorporate",
              "input": {
                "name": "Tidewater Studio, Inc.",
                "legalEntityType": "c_corp",
                "jurisdiction": "US-DE",
                "parValue": "100",
                "reason": "Incorporated in Delaware; the project's assets, liabilities and contracts are assigned to the corporation"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.incorporate-example-0"
            }
          },
          "business.record_formation_date.0": {
            "value": {
              "name": "business.record_formation_date",
              "input": {
                "date": "2026-09-15",
                "reason": "Certificate of formation"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.record_formation_date-example-0"
            }
          },
          "business.register_sales_tax.0": {
            "value": {
              "name": "business.register_sales_tax",
              "input": {
                "regime": "gb_vat",
                "registrationNumber": "GB123456789",
                "effectiveFrom": "2026-01-01",
                "reason": "VAT registration certificate received from HMRC"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.register_sales_tax-example-0"
            }
          },
          "business.register_sales_tax.1": {
            "value": {
              "name": "business.register_sales_tax",
              "input": {
                "regime": "ca_gst_hst",
                "registrationNumber": "123456789RT0001",
                "province": "CA-ON",
                "effectiveFrom": "2026-01-01",
                "reason": "Registered for GST/HST with the CRA"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.register_sales_tax-example-1"
            }
          },
          "business.set_registration.0": {
            "value": {
              "name": "business.set_registration",
              "input": {
                "kind": "us_ein",
                "number": "12-3456789",
                "reason": "EIN assigned by the IRS (notice CP 575)"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.set_registration-example-0"
            }
          },
          "business.update.0": {
            "value": {
              "name": "business.update",
              "input": {
                "description": "Accounting for agent-run startups",
                "url": "https://example.com"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.update-example-0"
            }
          },
          "business.update.1": {
            "value": {
              "name": "business.update",
              "input": {
                "ycVerificationUrl": "https://www.ycombinator.com/verify/Example123"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "business.update-example-1"
            }
          },
          "categories.create.0": {
            "value": {
              "name": "categories.create",
              "input": {
                "categoryId": "cat_example",
                "name": "Services",
                "code": "services"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "categories.create-example-0"
            }
          },
          "concessions.assign.0": {
            "value": {
              "name": "concessions.assign",
              "input": {
                "offerId": "cof_01",
                "email": "founder@example.com"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "concessions.assign-example-0"
            }
          },
          "concessions.create_offer.0": {
            "value": {
              "name": "concessions.create_offer",
              "input": {
                "name": "Design partner free year",
                "purpose": "research",
                "campaign": "design partners",
                "discount": {
                  "basisPoints": 10000,
                  "months": 12
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "concessions.create_offer-example-0"
            }
          },
          "concessions.reassign.0": {
            "value": {
              "name": "concessions.reassign",
              "input": {
                "offerId": "cof_01",
                "from": "founder@example.com",
                "to": "founder@gmail.com"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "concessions.reassign-example-0"
            }
          },
          "concessions.record_given.0": {
            "value": {
              "name": "concessions.record_given",
              "input": {
                "offerId": "cof_01",
                "contractId": "ctr_01",
                "email": "founder@example.com"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "concessions.record_given-example-0"
            }
          },
          "concessions.reserve.0": {
            "value": {
              "name": "concessions.reserve",
              "input": {
                "offerId": "cof_01",
                "email": "founder@example.com",
                "reservationKey": "enr_01"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "concessions.reserve-example-0"
            }
          },
          "concessions.retire.0": {
            "value": {
              "name": "concessions.retire",
              "input": {
                "offerId": "cof_01"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "concessions.retire-example-0"
            }
          },
          "connections.accept.0": {
            "value": {
              "name": "connections.accept",
              "input": {
                "connectionId": "con_01J00000000000000000000000",
                "partyId": "pty_acme"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "connections.accept-example-0"
            }
          },
          "connections.decline.0": {
            "value": {
              "name": "connections.decline",
              "input": {
                "connectionId": "con_01J00000000000000000000000"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "connections.decline-example-0"
            }
          },
          "connections.end.0": {
            "value": {
              "name": "connections.end",
              "input": {
                "connectionId": "con_01J00000000000000000000000"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "connections.end-example-0"
            }
          },
          "connections.request.0": {
            "value": {
              "name": "connections.request",
              "input": {
                "to": "globex-1a2b3c",
                "partyId": "pty_globex",
                "note": "We buy from you."
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "connections.request-example-0"
            }
          },
          "contracts.accept.0": {
            "value": {
              "name": "contracts.accept",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract",
                "expectedStatus": "draft",
                "effectiveAt": "2026-10-06T00:00:00Z",
                "sourceFactId": "agreement:accept",
                "evidence": {
                  "acceptance": [
                    {
                      "kind": "signed_doc",
                      "ref": "agreement:accept"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.accept-example-0"
            }
          },
          "contracts.add_granted_credit.0": {
            "value": {
              "name": "contracts.add_granted_credit",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract",
                "effectiveAt": "2026-09-10T00:00:00Z",
                "key": "startup_credit",
                "name": "Startup program credit",
                "eligibleRights": [
                  "api_usage"
                ],
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "doc_grant_email"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.add_granted_credit-example-0"
            }
          },
          "contracts.add_usage_meter.0": {
            "value": {
              "name": "contracts.add_usage_meter",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract",
                "effectiveAt": "2026-10-01T00:00:00Z",
                "key": "active_seats",
                "name": "Active seats",
                "unit": "seat",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "doc_admin_report"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.add_usage_meter-example-0"
            }
          },
          "contracts.adopt.0": {
            "value": {
              "name": "contracts.adopt",
              "input": {
                "vendorPlan": {
                  "cid": "bafkr4ideg6z2yocgkez77nr3outtvdnvjdcvqrs5phnqh7jvtrwnlpm5qu",
                  "template": "team"
                },
                "vendor": {
                  "create": {
                    "partyId": "party_vendor"
                  }
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.adopt-example-0"
            }
          },
          "contracts.amend.0": {
            "value": {
              "name": "contracts.amend",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract",
                "effectiveAt": "2026-10-01T00:00:00Z",
                "terms": {
                  "work": {
                    "rate": "25000"
                  }
                },
                "acceptanceEvidence": [
                  {
                    "kind": "signed_doc",
                    "ref": "amendment:signed"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.amend-example-0"
            }
          },
          "contracts.cancel.0": {
            "value": {
              "name": "contracts.cancel",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract",
                "expectedStatus": "draft",
                "effectiveAt": "2026-10-06T00:00:00Z",
                "sourceFactId": "agreement:cancel",
                "evidence": {
                  "acceptance": [
                    {
                      "kind": "signed_doc",
                      "ref": "agreement:cancel"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.cancel-example-0"
            }
          },
          "contracts.change_quantity.0": {
            "value": {
              "name": "contracts.change_quantity",
              "input": {
                "contractId": "ctr_example",
                "activityKey": "seats",
                "sourceFactId": "admin:seat-change",
                "requestedAt": "2026-10-20T00:00:00Z",
                "expectedQuantity": "5",
                "quantity": "7",
                "evidence": {
                  "service": [
                    {
                      "kind": "other",
                      "ref": "admin-log"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.change_quantity-example-0"
            }
          },
          "contracts.create.0": {
            "value": {
              "name": "contracts.create",
              "input": {
                "templateDocumentId": "doc_template",
                "parties": {
                  "customer": "party_customer"
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.create-example-0"
            }
          },
          "contracts.discard.0": {
            "value": {
              "name": "contracts.discard",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.discard-example-0"
            }
          },
          "contracts.give_notice.0": {
            "value": {
              "name": "contracts.give_notice",
              "input": {
                "contractId": "ctr_vendor",
                "expectedDocumentId": "doc_contract",
                "sourceFactId": "portal",
                "givenAt": "2027-02-14T00:00:00Z",
                "evidence": {
                  "acceptance": [
                    {
                      "kind": "other",
                      "ref": "vendor-portal"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.give_notice-example-0"
            }
          },
          "contracts.observe_usage.0": {
            "value": {
              "name": "contracts.observe_usage",
              "input": {
                "contractId": "ctr_example",
                "activityKey": "actions_linux",
                "observations": [
                  {
                    "producer": "github-billing-usage",
                    "sourceId": "2026-09-14/actions_linux/acme-org/acme-api",
                    "revision": 1,
                    "effectiveAt": "2026-09-14T00:00:00Z",
                    "quantity": "740",
                    "attribution": {
                      "customer": "pty_acme",
                      "project": "acme-api"
                    },
                    "evidence": [
                      {
                        "kind": "other",
                        "ref": "doc_example"
                      }
                    ]
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.observe_usage-example-0"
            }
          },
          "contracts.offer.0": {
            "value": {
              "name": "contracts.offer",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract",
                "expectedStatus": "draft",
                "effectiveAt": "2026-10-06T00:00:00Z",
                "sourceFactId": "agreement:offer",
                "evidence": {
                  "acceptance": [
                    {
                      "kind": "signed_doc",
                      "ref": "agreement:offer"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.offer-example-0"
            }
          },
          "contracts.reconcile_usage.0": {
            "value": {
              "name": "contracts.reconcile_usage",
              "input": {
                "contractId": "ctr_example",
                "sourceFactId": "invoice:doc_example",
                "effectiveAt": "2026-10-15T00:00:00Z",
                "source": {
                  "kind": "invoice",
                  "reference": "INV-0042"
                },
                "dueDate": "2026-10-15",
                "invoiceTotal": "6308",
                "lines": [
                  {
                    "lineKey": "3",
                    "description": "Actions Linux, September usage beyond 3,000 included minutes",
                    "activityKey": "actions_linux",
                    "period": {
                      "from": "2026-09-01T00:00:00Z",
                      "through": "2026-10-01T00:00:00Z"
                    },
                    "quantity": "4013",
                    "amount": "608"
                  },
                  {
                    "lineKey": "1",
                    "description": "Copilot Business seats",
                    "amount": "5700",
                    "handledElsewhere": true
                  }
                ],
                "evidence": {
                  "billing": [
                    {
                      "kind": "other",
                      "ref": "doc_example"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.reconcile_usage-example-0"
            }
          },
          "contracts.record.0": {
            "value": {
              "name": "contracts.record",
              "input": {
                "contractId": "ctr_example",
                "activityKey": "work",
                "occurrenceKey": "timesheet-1",
                "sourceFactId": "timesheet:approved:1",
                "effectiveAt": "2026-09-01T00:00:00Z",
                "facts": {
                  "quantity": "12500000"
                },
                "evidence": {
                  "service": [
                    {
                      "kind": "other",
                      "ref": "timesheet:approved:1"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.record-example-0"
            }
          },
          "contracts.renew.0": {
            "value": {
              "name": "contracts.renew",
              "input": {
                "contractId": "ctr_vendor",
                "expectedDocumentId": "doc_contract",
                "sourceFactId": "renewal-quote",
                "termIndex": 1,
                "evidence": {
                  "acceptance": [
                    {
                      "kind": "other",
                      "ref": "vendor-quote"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.renew-example-0"
            }
          },
          "contracts.resolve_usage_review.0": {
            "value": {
              "name": "contracts.resolve_usage_review",
              "input": {
                "contractId": "ctr_example",
                "effectiveAt": "2026-11-01T00:00:00Z",
                "decision": "Accept the vendor's credit",
                "reason": "Confirmed with support",
                "items": [
                  {
                    "reason": "credit_unfunded",
                    "activityKey": "actions",
                    "periodKey": "2026-09-01T00:00:00.000Z/2026-10-01T00:00:00.000Z",
                    "sourceFactId": "invoice:1"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.resolve_usage_review-example-0"
            }
          },
          "contracts.terminate.0": {
            "value": {
              "name": "contracts.terminate",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract",
                "expectedStatus": "active",
                "effectiveAt": "2026-10-06T00:00:00Z",
                "sourceFactId": "agreement:terminate",
                "evidence": {
                  "acceptance": [
                    {
                      "kind": "signed_doc",
                      "ref": "agreement:terminate"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.terminate-example-0"
            }
          },
          "contracts.void.0": {
            "value": {
              "name": "contracts.void",
              "input": {
                "contractId": "ctr_example",
                "expectedDocumentId": "doc_contract",
                "reason": "set up with the wrong usage metrics",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "founder:approval"
                  }
                ],
                "preview": true
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.void-example-0"
            }
          },
          "contracts.withdraw_notice.0": {
            "value": {
              "name": "contracts.withdraw_notice",
              "input": {
                "contractId": "ctr_vendor",
                "expectedDocumentId": "doc_contract",
                "sourceFactId": "changed-mind",
                "evidence": {
                  "acceptance": [
                    {
                      "kind": "other",
                      "ref": "vendor-portal"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "contracts.withdraw_notice-example-0"
            }
          },
          "documents.receive.0": {
            "value": {
              "name": "documents.receive",
              "input": {
                "kind": "source_document",
                "contentBase64": "VmVuZG9yIGludm9pY2UgIzEyMzogVVNEIDEwMC4wMA==",
                "externalId": "vendor-invoice-123",
                "title": "Vendor invoice 123"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "documents.receive-example-0"
            }
          },
          "documents.relate.0": {
            "value": {
              "name": "documents.relate",
              "input": {
                "fromDocumentId": "doc_replacement",
                "toDocumentId": "doc_original",
                "relation": "supersedes"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "documents.relate-example-0"
            }
          },
          "ingestions.attach_original.0": {
            "value": {
              "name": "ingestions.attach_original",
              "input": {
                "ingestionId": "ing_example",
                "file": {
                  "filename": "original.pdf",
                  "contentType": "application/pdf",
                  "size": 1024
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "ingestions.attach_original-example-0"
            }
          },
          "ingestions.invoice_candidates.0": {
            "value": {
              "name": "ingestions.invoice_candidates",
              "input": {
                "ingestionId": "ing_example",
                "invoiceText": "Exact retained extraction text"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "ingestions.invoice_candidates-example-0"
            }
          },
          "ingestions.reissue_upload.0": {
            "value": {
              "name": "ingestions.reissue_upload",
              "input": {
                "ingestionId": "ing_example",
                "role": "primary"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "ingestions.reissue_upload-example-0"
            }
          },
          "ingestions.resolve.0": {
            "value": {
              "name": "ingestions.resolve",
              "input": {
                "ingestionId": "ing_example",
                "expectedProposalRevision": 1,
                "expenseTargets": [
                  {
                    "contractId": "ctr_existing",
                    "activityKey": "expense"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "ingestions.resolve-example-0"
            }
          },
          "ingestions.start.0": {
            "value": {
              "name": "ingestions.start",
              "input": {
                "source": {
                  "type": "text",
                  "format": "markdown",
                  "text": "# Vendor invoice\nUSD 12.00"
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "ingestions.start-example-0"
            }
          },
          "journal.post.0": {
            "value": {
              "name": "journal.post",
              "input": {
                "description": "Founder contributed inventory",
                "currency": "USD",
                "lines": [
                  {
                    "accountCode": 1140,
                    "direction": "debit",
                    "amount": "10000"
                  },
                  {
                    "accountCode": 3100,
                    "direction": "credit",
                    "amount": "10000"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "journal.post-example-0"
            }
          },
          "journal.void.0": {
            "value": {
              "name": "journal.void",
              "input": {
                "eventId": 1,
                "reason": "Correction"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "journal.void-example-0"
            }
          },
          "members.grant.0": {
            "value": {
              "name": "members.grant",
              "input": {
                "principalId": "prin_example_teammate",
                "role": "owner"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "members.grant-example-0"
            }
          },
          "members.revoke.0": {
            "value": {
              "name": "members.revoke",
              "input": {
                "principalId": "prin_example_teammate"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "members.revoke-example-0"
            }
          },
          "messages.send.0": {
            "value": {
              "name": "messages.send",
              "input": {
                "topic": "feature_suggestion",
                "subject": "Import CSV bank statements",
                "body": "I wanted to import last month's bank statement as CSV and found no command for it.",
                "context": {
                  "tool": "documents.receive"
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "messages.send-example-0"
            }
          },
          "messages.send.1": {
            "value": {
              "name": "messages.send",
              "input": {
                "inReplyTo": "msg_01J00000000000000000000000",
                "body": "Thanks — the corrected invoice is attached to our books now.",
                "about": [
                  "doc_01J00000000000000000000000"
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "messages.send-example-1"
            }
          },
          "opportunities.link.0": {
            "value": {
              "name": "opportunities.link",
              "input": {
                "opportunityId": "opp_example",
                "expectedRevision": 1,
                "contractId": "ctr_successor",
                "contractDocumentId": "doc_successor",
                "activityKey": "accept",
                "occurrenceKey": "signed"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "opportunities.link-example-0"
            }
          },
          "opportunities.lose.0": {
            "value": {
              "name": "opportunities.lose",
              "input": {
                "opportunityId": "opp_example",
                "expectedRevision": 1,
                "reason": "Customer withdrew"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "opportunities.lose-example-0"
            }
          },
          "opportunities.open.0": {
            "value": {
              "name": "opportunities.open",
              "input": {
                "opportunityKey": "annual:example",
                "name": "Annual service",
                "partyId": "party_customer",
                "cohort": "customer",
                "kind": "new",
                "currency": "USD",
                "expectedValue": "1200000"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "opportunities.open-example-0"
            }
          },
          "opportunities.stage.0": {
            "value": {
              "name": "opportunities.stage",
              "input": {
                "opportunityId": "opp_example",
                "expectedRevision": 1,
                "stage": "qualified"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "opportunities.stage-example-0"
            }
          },
          "parties.add_contact.0": {
            "value": {
              "name": "parties.add_contact",
              "input": {
                "contactId": "contact_example_ap",
                "partyId": "pty_example_vendor",
                "name": "Accounts Payable",
                "email": "ap@example.com",
                "role": "billing"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "parties.add_contact-example-0"
            }
          },
          "parties.archive.0": {
            "value": {
              "name": "parties.archive",
              "input": {
                "partyId": "pty_example_vendor"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "parties.archive-example-0"
            }
          },
          "parties.create.0": {
            "value": {
              "name": "parties.create",
              "input": {
                "partyId": "pty_example_vendor",
                "name": "Example Vendor",
                "categories": [
                  "vendor"
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "parties.create-example-0"
            }
          },
          "parties.rebind_vendor_identity.0": {
            "value": {
              "name": "parties.rebind_vendor_identity",
              "input": {
                "vendorCatalog": "example/seller",
                "expectedPartyId": "pty_wrong",
                "partyId": "pty_right",
                "reason": "Correct seller from invoice"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "parties.rebind_vendor_identity-example-0"
            }
          },
          "parties.remove_contact.0": {
            "value": {
              "name": "parties.remove_contact",
              "input": {
                "partyId": "pty_example_vendor",
                "contactId": "contact_example_ap"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "parties.remove_contact-example-0"
            }
          },
          "parties.set_address.0": {
            "value": {
              "name": "parties.set_address",
              "input": {
                "partyId": "pty_example_vendor",
                "address": {
                  "line1": "1 Market Street",
                  "city": "San Francisco",
                  "country": "US"
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "parties.set_address-example-0"
            }
          },
          "parties.update.0": {
            "value": {
              "name": "parties.update",
              "input": {
                "partyId": "pty_example_vendor",
                "name": "Updated Vendor"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "parties.update-example-0"
            }
          },
          "payment_endpoints.register.0": {
            "value": {
              "name": "payment_endpoints.register",
              "input": {
                "paymentEndpointId": "vendor-ach",
                "partyId": "vendor",
                "uri": "payto://ach/110000000/123456789",
                "methods": [
                  {
                    "direction": "in",
                    "rail": "ach",
                    "asset": "USD"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "payment_endpoints.register-example-0"
            }
          },
          "payment_endpoints.update.0": {
            "value": {
              "name": "payment_endpoints.update",
              "input": {
                "paymentEndpointId": "vendor-ach",
                "active": false
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "payment_endpoints.update-example-0"
            }
          },
          "payroll.attribute_cost.0": {
            "value": {
              "name": "payroll.attribute_cost",
              "input": {
                "attributionId": "detail_example",
                "statementId": "payroll_example",
                "lineKey": "gross",
                "sourceFactId": "provider:detail:1",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "synthetic-detail"
                  }
                ],
                "allocations": [
                  {
                    "personPartyId": "pty_person",
                    "amount": "10000",
                    "month": "2026-10"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "payroll.attribute_cost-example-0"
            }
          },
          "payroll.link_funding.0": {
            "value": {
              "name": "payroll.link_funding",
              "input": {
                "paymentId": "pay_example",
                "purpose": "deposit",
                "sourceFactId": "provider:deposit:1",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "synthetic-deposit"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "payroll.link_funding-example-0"
            }
          },
          "payroll.link_recorded_cost.0": {
            "value": {
              "name": "payroll.link_recorded_cost",
              "input": {
                "linkId": "founder_cost",
                "postingId": 1,
                "personPartyId": "pty_person",
                "providerPartyId": "pty_creditor",
                "kind": "pay",
                "month": "2026-10",
                "sourceFactId": "founder:attribution:1",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "synthetic-founder-invoice"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "payroll.link_recorded_cost-example-0"
            }
          },
          "payroll.record_statement.0": {
            "value": {
              "name": "payroll.record_statement",
              "input": {
                "statementId": "payroll_example",
                "providerPartyId": "pty_provider",
                "sourceFactId": "provider:invoice:1",
                "currency": "USD",
                "total": "10000",
                "lines": [
                  {
                    "lineKey": "salary",
                    "kind": "pay",
                    "personPartyId": "pty_person",
                    "amount": "10000",
                    "month": "2026-10",
                    "expenseAccount": 5140,
                    "expenseFunction": "research_and_development"
                  }
                ],
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "synthetic-invoice"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "payroll.record_statement-example-0"
            }
          },
          "payroll.reverse_statement.0": {
            "value": {
              "name": "payroll.reverse_statement",
              "input": {
                "correctionId": "credit_example",
                "statementId": "payroll_example",
                "sourceFactId": "provider:credit:1",
                "reason": "Provider credit",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "synthetic-credit-note"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "payroll.reverse_statement-example-0"
            }
          },
          "people.link_identity.0": {
            "value": {
              "name": "people.link_identity",
              "input": {
                "identityId": "people_example",
                "from": "2026-01-01",
                "sourceFactId": "example:people",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "synthetic-evidence"
                  }
                ],
                "personPartyId": "pty_person",
                "kind": "person",
                "vendorPartyId": "pty_vendor",
                "accountId": "workspace",
                "holder": "user-1"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "people.link_identity-example-0"
            }
          },
          "people.record_arrangement.0": {
            "value": {
              "name": "people.record_arrangement",
              "input": {
                "arrangementId": "people_example",
                "from": "2026-01-01",
                "sourceFactId": "example:people",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "synthetic-evidence"
                  }
                ],
                "personPartyId": "pty_person",
                "kind": "contractor"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "people.record_arrangement-example-0"
            }
          },
          "people.set_membership.0": {
            "value": {
              "name": "people.set_membership",
              "input": {
                "membershipId": "people_example",
                "from": "2026-01-01",
                "sourceFactId": "example:people",
                "evidence": [
                  {
                    "kind": "other",
                    "ref": "synthetic-evidence"
                  }
                ],
                "partyId": "pty_person"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "people.set_membership-example-0"
            }
          },
          "presentation_rate.record.0": {
            "value": {
              "name": "presentation_rate.record",
              "input": {
                "packageId": "ch-co-ordinary-standalone-ag-gmbh-software-services-2026.1",
                "baseCurrency": "USD",
                "quoteCurrency": "CHF",
                "numerator": "4",
                "denominator": "5",
                "observedAt": "2026-09-30T23:59:59.999Z",
                "source": "manual_evidenced"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "presentation_rate.record-example-0"
            }
          },
          "report_definitions.archive.0": {
            "value": {
              "name": "report_definitions.archive",
              "input": {
                "id": "rpt_01K00000000000000000000000"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "report_definitions.archive-example-0"
            }
          },
          "report_definitions.pin.0": {
            "value": {
              "name": "report_definitions.pin",
              "input": {
                "id": "rpt_01K00000000000000000000000",
                "overview": true
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "report_definitions.pin-example-0"
            }
          },
          "report_definitions.publish.0": {
            "value": {
              "name": "report_definitions.publish",
              "input": {
                "definition": {
                  "spec": "economico.report/1",
                  "report_schema": 1,
                  "title": "Example",
                  "blocks": [
                    {
                      "type": "query",
                      "title": "Parties",
                      "sql": "SELECT name FROM parties LIMIT 10"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "report_definitions.publish-example-0"
            }
          },
          "report_definitions.unpin.0": {
            "value": {
              "name": "report_definitions.unpin",
              "input": {
                "id": "rpt_01K00000000000000000000000"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "report_definitions.unpin-example-0"
            }
          },
          "reporting_adjustment.post.0": {
            "value": {
              "name": "reporting_adjustment.post",
              "input": {
                "packageId": "us-gaap-private-c-corp-software-services-2026.1",
                "requirement": "asc-350-40-internal-use-software-conclusion",
                "description": "Capitalize qualifying internal-use software costs",
                "currency": "USD",
                "lines": [
                  {
                    "accountCode": 1280,
                    "direction": "debit",
                    "amount": "10000"
                  },
                  {
                    "accountCode": 5110,
                    "subKey": {
                      "kind": 6,
                      "expenseFunction": "research_and_development"
                    },
                    "direction": "credit",
                    "amount": "10000"
                  }
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "reporting_adjustment.post-example-0"
            }
          },
          "reporting_adjustment.void.0": {
            "value": {
              "name": "reporting_adjustment.void",
              "input": {
                "eventId": 1,
                "reason": "Correction"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "reporting_adjustment.void-example-0"
            }
          },
          "reporting_profile.select.0": {
            "value": {
              "name": "reporting_profile.select",
              "input": {
                "packageId": "us-gaap-private-c-corp-software-services-2026.1",
                "jurisdiction": "US",
                "legalEntityScope": "private-c-corporation-software-services",
                "framework": "US GAAP",
                "frameworkEdition": "2026",
                "policyElections": [
                  "private-company-alternatives-not-elected"
                ]
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "reporting_profile.select-example-0"
            }
          },
          "shared_views.create.0": {
            "value": {
              "name": "shared_views.create",
              "input": {
                "description": "Investor update",
                "reports": [
                  "balance_sheet",
                  "income_statement"
                ],
                "expiresAt": "2027-01-01T00:00:00Z"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "shared_views.create-example-0"
            }
          },
          "shared_views.revoke.0": {
            "value": {
              "name": "shared_views.revoke",
              "input": {
                "viewId": "shv_example"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "shared_views.revoke-example-0"
            }
          },
          "subscription.cancel_request.0": {
            "value": {
              "name": "subscription.cancel_request",
              "input": {
                "reason": "We no longer need this business account."
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "subscription.cancel_request-example-0"
            }
          },
          "subscription.revoke_cancellation.0": {
            "value": {
              "name": "subscription.revoke_cancellation",
              "input": {
                "cancellationId": "can_example"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "subscription.revoke_cancellation-example-0"
            }
          },
          "tax_codes.create.0": {
            "value": {
              "name": "tax_codes.create",
              "input": {
                "taxCodeId": "us-ca-sales",
                "code": "us-ca-sales",
                "name": "California sales tax",
                "ratePpm": 72500
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "tax_codes.create-example-0"
            }
          },
          "tax_codes.update.0": {
            "value": {
              "name": "tax_codes.update",
              "input": {
                "taxCodeId": "us-ca-sales",
                "active": false
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "tax_codes.update-example-0"
            }
          },
          "templates.archive.0": {
            "value": {
              "name": "templates.archive",
              "input": {
                "id": "template_example",
                "expectedDocumentId": "doc_current"
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "templates.archive-example-0"
            }
          },
          "templates.create.0": {
            "value": {
              "name": "templates.create",
              "input": {
                "definition": {
                  "model": "priced-rights-v1",
                  "name": "Consulting",
                  "parties": [
                    "customer"
                  ],
                  "activities": [
                    {
                      "key": "work",
                      "activityDocumentId": "doc_activity",
                      "partyRole": "customer"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "templates.create-example-0"
            }
          },
          "templates.replace.0": {
            "value": {
              "name": "templates.replace",
              "input": {
                "id": "template_example",
                "expectedDocumentId": "doc_previous",
                "definition": {
                  "model": "priced-rights-v1",
                  "name": "Consulting",
                  "parties": [
                    "customer"
                  ],
                  "activities": [
                    {
                      "key": "work",
                      "activityDocumentId": "doc_activity",
                      "partyRole": "customer"
                    }
                  ]
                }
              },
              "effective_at": "2026-09-01T00:00:00Z",
              "idempotency_key": "templates.replace-example-0"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {
            "anyOf": [
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "financialAccountId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "currency": {
                        "type": "string",
                        "minLength": 1
                      },
                      "glAccountCode": {
                        "enum": [
                          1110,
                          1310,
                          1410,
                          2190,
                          2135
                        ]
                      },
                      "kind": {
                        "enum": [
                          "checking",
                          "savings",
                          "card",
                          "wallet",
                          "other"
                        ]
                      },
                      "isDefault": {
                        "type": "boolean"
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "ownerPartyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "providerPartyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "providerContractId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "last4": {
                        "type": "string",
                        "pattern": "^[0-9]{4}$"
                      },
                      "network": {
                        "type": "string",
                        "minLength": 1
                      },
                      "brandColor": {
                        "type": "string",
                        "pattern": "^#[0-9A-Fa-f]{6}$",
                        "description": "The issuer's brand color as #RRGGBB, drawn as the account's card or plate."
                      },
                      "logoDocumentId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The issuer's logo: the documentId of an image document (documents.receive kind image, PNG/JPEG/WebP)."
                      }
                    },
                    "required": [
                      "financialAccountId",
                      "name",
                      "currency",
                      "glAccountCode",
                      "kind",
                      "isDefault",
                      "archived"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "financialAccountId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "currency": {
                        "type": "string",
                        "minLength": 1
                      },
                      "glAccountCode": {
                        "enum": [
                          1110,
                          1310,
                          1410,
                          2190,
                          2135
                        ]
                      },
                      "kind": {
                        "enum": [
                          "checking",
                          "savings",
                          "card",
                          "wallet",
                          "other"
                        ]
                      },
                      "isDefault": {
                        "type": "boolean"
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "ownerPartyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "providerPartyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "providerContractId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "last4": {
                        "type": "string",
                        "pattern": "^[0-9]{4}$"
                      },
                      "network": {
                        "type": "string",
                        "minLength": 1
                      },
                      "brandColor": {
                        "type": "string",
                        "pattern": "^#[0-9A-Fa-f]{6}$",
                        "description": "The issuer's brand color as #RRGGBB, drawn as the account's card or plate."
                      },
                      "logoDocumentId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The issuer's logo: the documentId of an image document (documents.receive kind image, PNG/JPEG/WebP)."
                      }
                    },
                    "required": [
                      "financialAccountId",
                      "name",
                      "currency",
                      "glAccountCode",
                      "kind",
                      "isDefault",
                      "archived"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "financialAccountId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "currency": {
                        "type": "string",
                        "minLength": 1
                      },
                      "glAccountCode": {
                        "enum": [
                          1110,
                          1310,
                          1410,
                          2190,
                          2135
                        ]
                      },
                      "kind": {
                        "enum": [
                          "checking",
                          "savings",
                          "card",
                          "wallet",
                          "other"
                        ]
                      },
                      "isDefault": {
                        "type": "boolean"
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "ownerPartyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "providerPartyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "providerContractId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "last4": {
                        "type": "string",
                        "pattern": "^[0-9]{4}$"
                      },
                      "network": {
                        "type": "string",
                        "minLength": 1
                      },
                      "brandColor": {
                        "type": "string",
                        "pattern": "^#[0-9A-Fa-f]{6}$",
                        "description": "The issuer's brand color as #RRGGBB, drawn as the account's card or plate."
                      },
                      "logoDocumentId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The issuer's logo: the documentId of an image document (documents.receive kind image, PNG/JPEG/WebP)."
                      }
                    },
                    "required": [
                      "financialAccountId",
                      "name",
                      "currency",
                      "glAccountCode",
                      "kind",
                      "isDefault",
                      "archived"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "financialAccountId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "openingBalance": {
                        "type": "string",
                        "pattern": "^-?(0|[1-9][0-9]*)$",
                        "description": "Exact signed minor units at the start of openingDate. Positive is money held for a bank/wallet, amount owed for a card. Use with openingDate, including for zero."
                      },
                      "openingDate": {
                        "type": "string",
                        "format": "date",
                        "description": "YYYY-MM-DD, inclusive start of the account's books (UTC). Earlier payments and journals are refused."
                      },
                      "openingEquityAccountCode": {
                        "type": "integer",
                        "description": "Postable equity chart account for the other side; defaults to 3900 Opening balance equity."
                      }
                    },
                    "required": [
                      "financialAccountId",
                      "openingBalance",
                      "openingDate",
                      "openingEquityAccountCode"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "financialAccountId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "currency": {
                        "type": "string",
                        "minLength": 1
                      },
                      "glAccountCode": {
                        "enum": [
                          1110,
                          1310,
                          1410,
                          2190,
                          2135
                        ]
                      },
                      "kind": {
                        "enum": [
                          "checking",
                          "savings",
                          "card",
                          "wallet",
                          "other"
                        ]
                      },
                      "isDefault": {
                        "type": "boolean"
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "ownerPartyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "providerPartyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "providerContractId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "last4": {
                        "type": "string",
                        "pattern": "^[0-9]{4}$"
                      },
                      "network": {
                        "type": "string",
                        "minLength": 1
                      },
                      "brandColor": {
                        "type": "string",
                        "pattern": "^#[0-9A-Fa-f]{6}$",
                        "description": "The issuer's brand color as #RRGGBB, drawn as the account's card or plate."
                      },
                      "logoDocumentId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The issuer's logo: the documentId of an image document (documents.receive kind image, PNG/JPEG/WebP)."
                      }
                    },
                    "required": [
                      "financialAccountId",
                      "name",
                      "currency",
                      "glAccountCode",
                      "kind",
                      "isDefault",
                      "archived"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "id"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "id",
                      "documentId",
                      "cid"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "id",
                      "documentId",
                      "cid"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "yearEnd",
                      "effectiveFrom",
                      "transitionPeriod"
                    ],
                    "properties": {
                      "yearEnd": {
                        "type": "string"
                      },
                      "effectiveFrom": {
                        "type": "string",
                        "format": "date"
                      },
                      "transitionPeriod": {
                        "type": "object",
                        "required": [
                          "start",
                          "end",
                          "months",
                          "days"
                        ],
                        "properties": {
                          "start": {
                            "type": "string",
                            "format": "date"
                          },
                          "end": {
                            "type": "string",
                            "format": "date"
                          },
                          "months": {
                            "type": "integer"
                          },
                          "days": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "currency",
                      "primaryLedgerId",
                      "closedLedgerIds"
                    ],
                    "properties": {
                      "currency": {
                        "type": "string"
                      },
                      "primaryLedgerId": {
                        "type": "string"
                      },
                      "closedLedgerIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "demo": {
                        "const": true,
                        "description": "Present only on a demo business: a fictional company, its owner's alone, that never takes a plan or reaches anyone but Economico, which it can send support requests and suggestions. Its figures are not real."
                      },
                      "demoOpenedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "On a demo business: when it was opened. Its seeded books run up to here."
                      },
                      "name": {
                        "type": "string",
                        "description": "The public name."
                      },
                      "legalName": {
                        "type": "string",
                        "description": "The registered name agreements and documents use; a project's is its owner's."
                      },
                      "legalEntityType": {
                        "enum": [
                          "unknown",
                          "llc",
                          "c_corp",
                          "s_corp",
                          "sole_proprietorship",
                          "partnership",
                          "nonprofit",
                          "unincorporated",
                          "other",
                          "private_limited_company",
                          "corporation",
                          "stock_corporation",
                          "project"
                        ]
                      },
                      "ownership": {
                        "type": "object",
                        "description": "What the legal form means for equity: the balance sheet's equity heading, the ownership reports that apply (primary first) and the company-setup skill's ownership recipes.",
                        "properties": {
                          "family": {
                            "enum": [
                              "corporation",
                              "members",
                              "partners",
                              "owner",
                              "nonprofit",
                              "unspecified"
                            ]
                          },
                          "equityLabel": {
                            "type": "string"
                          },
                          "reports": {
                            "type": "array",
                            "items": {
                              "enum": [
                                "cap_table",
                                "capital_accounts"
                              ]
                            }
                          },
                          "recipes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "family",
                          "equityLabel",
                          "reports",
                          "recipes"
                        ]
                      },
                      "jurisdiction": {
                        "type": "string"
                      },
                      "formationDate": {
                        "type": "string",
                        "format": "date"
                      },
                      "formationDateEventId": {
                        "type": "integer"
                      },
                      "nameEventId": {
                        "type": "integer"
                      },
                      "legalNameEventId": {
                        "type": "integer"
                      },
                      "legalEntityTypeEventId": {
                        "type": "integer"
                      },
                      "jurisdictionEventId": {
                        "type": "integer"
                      },
                      "registrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "enum": [
                                "us_ein",
                                "sg_uen",
                                "ca_bn",
                                "gb_company_number"
                              ]
                            },
                            "number": {
                              "type": "string"
                            },
                            "eventId": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "kind",
                            "number",
                            "eventId"
                          ]
                        }
                      },
                      "description": {
                        "type": "string"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "line1": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]+$"
                          },
                          "line2": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "city": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]+$"
                          },
                          "region": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "postalCode": {
                            "type": "string",
                            "maxLength": 40,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "country": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          }
                        },
                        "required": [
                          "line1",
                          "city",
                          "country"
                        ],
                        "additionalProperties": false
                      },
                      "url": {
                        "type": "string",
                        "pattern": "^https?://"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "functionalCurrency": {
                        "type": "string"
                      },
                      "primaryLedgerId": {
                        "type": "string"
                      },
                      "successions": {
                        "type": "array",
                        "description": "Incorporations in place (business.incorporate), oldest first.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "eventId": {
                              "type": "integer"
                            },
                            "effectiveAt": {
                              "type": "string"
                            },
                            "previousName": {
                              "type": "string"
                            },
                            "previousLegalEntityType": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "legalEntityType": {
                              "type": "string"
                            },
                            "predecessorLedgerId": {
                              "type": "string"
                            },
                            "successorLedgerId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "eventId",
                            "effectiveAt",
                            "previousLegalEntityType",
                            "name",
                            "legalEntityType",
                            "predecessorLedgerId",
                            "successorLedgerId"
                          ]
                        }
                      },
                      "functionalCurrencyPeriods": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "currency": {
                              "type": "string"
                            },
                            "ledgerId": {
                              "type": "string"
                            },
                            "effectiveFrom": {
                              "type": "string"
                            },
                            "effectiveUntil": {
                              "type": "string"
                            },
                            "changeEventId": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "currency",
                            "ledgerId",
                            "effectiveFrom",
                            "changeEventId"
                          ]
                        }
                      },
                      "accountingFramework": {
                        "type": "object",
                        "required": [
                          "framework",
                          "reason",
                          "jurisdiction",
                          "evidenceDocumentId",
                          "evidenceDocumentCid",
                          "effectiveAt"
                        ],
                        "properties": {
                          "framework": {
                            "type": "string"
                          },
                          "edition": {
                            "type": "string"
                          },
                          "sizeRegime": {
                            "enum": [
                              "small",
                              "micro"
                            ]
                          },
                          "sizeEligibility": {
                            "type": "object",
                            "required": [
                              "basis",
                              "periodEnd"
                            ],
                            "properties": {
                              "basis": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                              },
                              "periodEnd": {
                                "type": "string",
                                "format": "date",
                                "description": "Period end the conclusion covers."
                              }
                            }
                          },
                          "reason": {
                            "type": "string"
                          },
                          "jurisdiction": {
                            "type": "string"
                          },
                          "evidenceDocumentId": {
                            "type": "string"
                          },
                          "evidenceDocumentCid": {
                            "type": "string"
                          },
                          "effectiveAt": {
                            "type": "string"
                          },
                          "eventId": {
                            "type": "integer"
                          }
                        }
                      },
                      "accountingFrameworkHistory": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "framework",
                            "reason",
                            "jurisdiction",
                            "evidenceDocumentId",
                            "evidenceDocumentCid",
                            "effectiveAt"
                          ],
                          "properties": {
                            "framework": {
                              "type": "string"
                            },
                            "edition": {
                              "type": "string"
                            },
                            "sizeRegime": {
                              "enum": [
                                "small",
                                "micro"
                              ]
                            },
                            "sizeEligibility": {
                              "type": "object",
                              "required": [
                                "basis",
                                "periodEnd"
                              ],
                              "properties": {
                                "basis": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000,
                                  "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                                },
                                "periodEnd": {
                                  "type": "string",
                                  "format": "date",
                                  "description": "Period end the conclusion covers."
                                }
                              }
                            },
                            "reason": {
                              "type": "string"
                            },
                            "jurisdiction": {
                              "type": "string"
                            },
                            "evidenceDocumentId": {
                              "type": "string"
                            },
                            "evidenceDocumentCid": {
                              "type": "string"
                            },
                            "effectiveAt": {
                              "type": "string"
                            },
                            "eventId": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "salesTaxRegistrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "registrationId": {
                              "type": "string"
                            },
                            "regime": {
                              "enum": [
                                "sg_gst",
                                "ca_gst_hst",
                                "ca_qst",
                                "ca_pst_bc",
                                "ca_pst_sk",
                                "ca_rst_mb",
                                "gb_vat"
                              ],
                              "description": "sg_gst (Singapore GST); ca_gst_hst (Canadian GST/HST), ca_qst (Quebec QST), ca_pst_bc, ca_pst_sk, ca_rst_mb (provincial sales taxes, kept apart from GST/HST); gb_vat (UK VAT). It must be a regime of the country the business is incorporated in. There is no US regime: record US state sales tax as custom codes with tax_codes.create."
                            },
                            "country": {
                              "type": "string"
                            },
                            "registrationNumber": {
                              "type": "string"
                            },
                            "province": {
                              "type": "string"
                            },
                            "effectiveFrom": {
                              "type": "string",
                              "format": "date"
                            },
                            "effectiveUntil": {
                              "type": "string",
                              "format": "date"
                            },
                            "reason": {
                              "type": "string"
                            },
                            "sourceDocumentId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "registrationId",
                            "regime",
                            "country",
                            "registrationNumber",
                            "effectiveFrom",
                            "reason",
                            "sourceDocumentId"
                          ]
                        }
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri",
                        "description": "The logo the business's share pages show."
                      },
                      "logoCid": {
                        "type": "string",
                        "description": "The CID in logoUrl."
                      },
                      "ycVerified": {
                        "type": "boolean"
                      },
                      "ycVerificationUrl": {
                        "type": "string"
                      },
                      "ycVerifiedAt": {
                        "type": "string"
                      },
                      "ycBatch": {
                        "type": "string"
                      },
                      "ycFounderName": {
                        "type": "string"
                      },
                      "ycVerificationPending": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "requestedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "url",
                          "requestedAt"
                        ]
                      },
                      "ycVerificationError": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "ycVerified"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "demo": {
                        "const": true,
                        "description": "Present only on a demo business: a fictional company, its owner's alone, that never takes a plan or reaches anyone but Economico, which it can send support requests and suggestions. Its figures are not real."
                      },
                      "demoOpenedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "On a demo business: when it was opened. Its seeded books run up to here."
                      },
                      "name": {
                        "type": "string",
                        "description": "The public name."
                      },
                      "legalName": {
                        "type": "string",
                        "description": "The registered name agreements and documents use; a project's is its owner's."
                      },
                      "legalEntityType": {
                        "enum": [
                          "unknown",
                          "llc",
                          "c_corp",
                          "s_corp",
                          "sole_proprietorship",
                          "partnership",
                          "nonprofit",
                          "unincorporated",
                          "other",
                          "private_limited_company",
                          "corporation",
                          "stock_corporation",
                          "project"
                        ]
                      },
                      "ownership": {
                        "type": "object",
                        "description": "What the legal form means for equity: the balance sheet's equity heading, the ownership reports that apply (primary first) and the company-setup skill's ownership recipes.",
                        "properties": {
                          "family": {
                            "enum": [
                              "corporation",
                              "members",
                              "partners",
                              "owner",
                              "nonprofit",
                              "unspecified"
                            ]
                          },
                          "equityLabel": {
                            "type": "string"
                          },
                          "reports": {
                            "type": "array",
                            "items": {
                              "enum": [
                                "cap_table",
                                "capital_accounts"
                              ]
                            }
                          },
                          "recipes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "family",
                          "equityLabel",
                          "reports",
                          "recipes"
                        ]
                      },
                      "jurisdiction": {
                        "type": "string"
                      },
                      "formationDate": {
                        "type": "string",
                        "format": "date"
                      },
                      "formationDateEventId": {
                        "type": "integer"
                      },
                      "nameEventId": {
                        "type": "integer"
                      },
                      "legalNameEventId": {
                        "type": "integer"
                      },
                      "legalEntityTypeEventId": {
                        "type": "integer"
                      },
                      "jurisdictionEventId": {
                        "type": "integer"
                      },
                      "registrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "enum": [
                                "us_ein",
                                "sg_uen",
                                "ca_bn",
                                "gb_company_number"
                              ]
                            },
                            "number": {
                              "type": "string"
                            },
                            "eventId": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "kind",
                            "number",
                            "eventId"
                          ]
                        }
                      },
                      "description": {
                        "type": "string"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "line1": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]+$"
                          },
                          "line2": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "city": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]+$"
                          },
                          "region": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "postalCode": {
                            "type": "string",
                            "maxLength": 40,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "country": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          }
                        },
                        "required": [
                          "line1",
                          "city",
                          "country"
                        ],
                        "additionalProperties": false
                      },
                      "url": {
                        "type": "string",
                        "pattern": "^https?://"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "functionalCurrency": {
                        "type": "string"
                      },
                      "primaryLedgerId": {
                        "type": "string"
                      },
                      "successions": {
                        "type": "array",
                        "description": "Incorporations in place (business.incorporate), oldest first.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "eventId": {
                              "type": "integer"
                            },
                            "effectiveAt": {
                              "type": "string"
                            },
                            "previousName": {
                              "type": "string"
                            },
                            "previousLegalEntityType": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "legalEntityType": {
                              "type": "string"
                            },
                            "predecessorLedgerId": {
                              "type": "string"
                            },
                            "successorLedgerId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "eventId",
                            "effectiveAt",
                            "previousLegalEntityType",
                            "name",
                            "legalEntityType",
                            "predecessorLedgerId",
                            "successorLedgerId"
                          ]
                        }
                      },
                      "functionalCurrencyPeriods": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "currency": {
                              "type": "string"
                            },
                            "ledgerId": {
                              "type": "string"
                            },
                            "effectiveFrom": {
                              "type": "string"
                            },
                            "effectiveUntil": {
                              "type": "string"
                            },
                            "changeEventId": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "currency",
                            "ledgerId",
                            "effectiveFrom",
                            "changeEventId"
                          ]
                        }
                      },
                      "accountingFramework": {
                        "type": "object",
                        "required": [
                          "framework",
                          "reason",
                          "jurisdiction",
                          "evidenceDocumentId",
                          "evidenceDocumentCid",
                          "effectiveAt"
                        ],
                        "properties": {
                          "framework": {
                            "type": "string"
                          },
                          "edition": {
                            "type": "string"
                          },
                          "sizeRegime": {
                            "enum": [
                              "small",
                              "micro"
                            ]
                          },
                          "sizeEligibility": {
                            "type": "object",
                            "required": [
                              "basis",
                              "periodEnd"
                            ],
                            "properties": {
                              "basis": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                              },
                              "periodEnd": {
                                "type": "string",
                                "format": "date",
                                "description": "Period end the conclusion covers."
                              }
                            }
                          },
                          "reason": {
                            "type": "string"
                          },
                          "jurisdiction": {
                            "type": "string"
                          },
                          "evidenceDocumentId": {
                            "type": "string"
                          },
                          "evidenceDocumentCid": {
                            "type": "string"
                          },
                          "effectiveAt": {
                            "type": "string"
                          },
                          "eventId": {
                            "type": "integer"
                          }
                        }
                      },
                      "accountingFrameworkHistory": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "framework",
                            "reason",
                            "jurisdiction",
                            "evidenceDocumentId",
                            "evidenceDocumentCid",
                            "effectiveAt"
                          ],
                          "properties": {
                            "framework": {
                              "type": "string"
                            },
                            "edition": {
                              "type": "string"
                            },
                            "sizeRegime": {
                              "enum": [
                                "small",
                                "micro"
                              ]
                            },
                            "sizeEligibility": {
                              "type": "object",
                              "required": [
                                "basis",
                                "periodEnd"
                              ],
                              "properties": {
                                "basis": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000,
                                  "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                                },
                                "periodEnd": {
                                  "type": "string",
                                  "format": "date",
                                  "description": "Period end the conclusion covers."
                                }
                              }
                            },
                            "reason": {
                              "type": "string"
                            },
                            "jurisdiction": {
                              "type": "string"
                            },
                            "evidenceDocumentId": {
                              "type": "string"
                            },
                            "evidenceDocumentCid": {
                              "type": "string"
                            },
                            "effectiveAt": {
                              "type": "string"
                            },
                            "eventId": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "salesTaxRegistrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "registrationId": {
                              "type": "string"
                            },
                            "regime": {
                              "enum": [
                                "sg_gst",
                                "ca_gst_hst",
                                "ca_qst",
                                "ca_pst_bc",
                                "ca_pst_sk",
                                "ca_rst_mb",
                                "gb_vat"
                              ],
                              "description": "sg_gst (Singapore GST); ca_gst_hst (Canadian GST/HST), ca_qst (Quebec QST), ca_pst_bc, ca_pst_sk, ca_rst_mb (provincial sales taxes, kept apart from GST/HST); gb_vat (UK VAT). It must be a regime of the country the business is incorporated in. There is no US regime: record US state sales tax as custom codes with tax_codes.create."
                            },
                            "country": {
                              "type": "string"
                            },
                            "registrationNumber": {
                              "type": "string"
                            },
                            "province": {
                              "type": "string"
                            },
                            "effectiveFrom": {
                              "type": "string",
                              "format": "date"
                            },
                            "effectiveUntil": {
                              "type": "string",
                              "format": "date"
                            },
                            "reason": {
                              "type": "string"
                            },
                            "sourceDocumentId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "registrationId",
                            "regime",
                            "country",
                            "registrationNumber",
                            "effectiveFrom",
                            "reason",
                            "sourceDocumentId"
                          ]
                        }
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri",
                        "description": "The logo the business's share pages show."
                      },
                      "logoCid": {
                        "type": "string",
                        "description": "The CID in logoUrl."
                      },
                      "ycVerified": {
                        "type": "boolean"
                      },
                      "ycVerificationUrl": {
                        "type": "string"
                      },
                      "ycVerifiedAt": {
                        "type": "string"
                      },
                      "ycBatch": {
                        "type": "string"
                      },
                      "ycFounderName": {
                        "type": "string"
                      },
                      "ycVerificationPending": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "requestedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "url",
                          "requestedAt"
                        ]
                      },
                      "ycVerificationError": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "ycVerified"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "registration"
                    ],
                    "properties": {
                      "registration": {
                        "type": "object",
                        "properties": {
                          "registrationId": {
                            "type": "string"
                          },
                          "regime": {
                            "enum": [
                              "sg_gst",
                              "ca_gst_hst",
                              "ca_qst",
                              "ca_pst_bc",
                              "ca_pst_sk",
                              "ca_rst_mb",
                              "gb_vat"
                            ],
                            "description": "sg_gst (Singapore GST); ca_gst_hst (Canadian GST/HST), ca_qst (Quebec QST), ca_pst_bc, ca_pst_sk, ca_rst_mb (provincial sales taxes, kept apart from GST/HST); gb_vat (UK VAT). It must be a regime of the country the business is incorporated in. There is no US regime: record US state sales tax as custom codes with tax_codes.create."
                          },
                          "country": {
                            "type": "string"
                          },
                          "registrationNumber": {
                            "type": "string"
                          },
                          "province": {
                            "type": "string"
                          },
                          "effectiveFrom": {
                            "type": "string",
                            "format": "date"
                          },
                          "effectiveUntil": {
                            "type": "string",
                            "format": "date"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "sourceDocumentId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "registrationId",
                          "regime",
                          "country",
                          "registrationNumber",
                          "effectiveFrom",
                          "reason",
                          "sourceDocumentId"
                        ]
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "framework",
                      "reason",
                      "jurisdiction",
                      "evidenceDocumentId",
                      "evidenceDocumentCid",
                      "effectiveAt"
                    ],
                    "properties": {
                      "framework": {
                        "type": "string"
                      },
                      "edition": {
                        "type": "string"
                      },
                      "sizeRegime": {
                        "enum": [
                          "small",
                          "micro"
                        ]
                      },
                      "sizeEligibility": {
                        "type": "object",
                        "required": [
                          "basis",
                          "periodEnd"
                        ],
                        "properties": {
                          "basis": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000,
                            "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                          },
                          "periodEnd": {
                            "type": "string",
                            "format": "date",
                            "description": "Period end the conclusion covers."
                          }
                        }
                      },
                      "reason": {
                        "type": "string"
                      },
                      "jurisdiction": {
                        "type": "string"
                      },
                      "evidenceDocumentId": {
                        "type": "string"
                      },
                      "evidenceDocumentCid": {
                        "type": "string"
                      },
                      "effectiveAt": {
                        "type": "string"
                      },
                      "eventId": {
                        "type": "integer"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "name",
                      "legalEntityType",
                      "jurisdiction",
                      "ownerPartyId",
                      "predecessorLedgerId",
                      "primaryLedgerId",
                      "contributedCapital",
                      "parValue",
                      "openingLines",
                      "successorLedgers"
                    ],
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "legalEntityType": {
                        "type": "string"
                      },
                      "jurisdiction": {
                        "type": "string"
                      },
                      "ownerPartyId": {
                        "type": "string"
                      },
                      "predecessorLedgerId": {
                        "type": "string"
                      },
                      "primaryLedgerId": {
                        "type": "string"
                      },
                      "contributedCapital": {
                        "type": "string"
                      },
                      "parValue": {
                        "type": "string"
                      },
                      "openingLines": {
                        "type": "integer"
                      },
                      "successorLedgers": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "currency",
                            "predecessorLedgerId",
                            "successorLedgerId"
                          ],
                          "properties": {
                            "currency": {
                              "type": "string"
                            },
                            "predecessorLedgerId": {
                              "type": "string"
                            },
                            "successorLedgerId": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "date"
                    ],
                    "properties": {
                      "date": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "registration",
                      "seededTaxCodes"
                    ],
                    "properties": {
                      "registration": {
                        "type": "object",
                        "properties": {
                          "registrationId": {
                            "type": "string"
                          },
                          "regime": {
                            "enum": [
                              "sg_gst",
                              "ca_gst_hst",
                              "ca_qst",
                              "ca_pst_bc",
                              "ca_pst_sk",
                              "ca_rst_mb",
                              "gb_vat"
                            ],
                            "description": "sg_gst (Singapore GST); ca_gst_hst (Canadian GST/HST), ca_qst (Quebec QST), ca_pst_bc, ca_pst_sk, ca_rst_mb (provincial sales taxes, kept apart from GST/HST); gb_vat (UK VAT). It must be a regime of the country the business is incorporated in. There is no US regime: record US state sales tax as custom codes with tax_codes.create."
                          },
                          "country": {
                            "type": "string"
                          },
                          "registrationNumber": {
                            "type": "string"
                          },
                          "province": {
                            "type": "string"
                          },
                          "effectiveFrom": {
                            "type": "string",
                            "format": "date"
                          },
                          "effectiveUntil": {
                            "type": "string",
                            "format": "date"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "sourceDocumentId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "registrationId",
                          "regime",
                          "country",
                          "registrationNumber",
                          "effectiveFrom",
                          "reason",
                          "sourceDocumentId"
                        ]
                      },
                      "seededTaxCodes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "demo": {
                        "const": true,
                        "description": "Present only on a demo business: a fictional company, its owner's alone, that never takes a plan or reaches anyone but Economico, which it can send support requests and suggestions. Its figures are not real."
                      },
                      "demoOpenedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "On a demo business: when it was opened. Its seeded books run up to here."
                      },
                      "name": {
                        "type": "string",
                        "description": "The public name."
                      },
                      "legalName": {
                        "type": "string",
                        "description": "The registered name agreements and documents use; a project's is its owner's."
                      },
                      "legalEntityType": {
                        "enum": [
                          "unknown",
                          "llc",
                          "c_corp",
                          "s_corp",
                          "sole_proprietorship",
                          "partnership",
                          "nonprofit",
                          "unincorporated",
                          "other",
                          "private_limited_company",
                          "corporation",
                          "stock_corporation",
                          "project"
                        ]
                      },
                      "ownership": {
                        "type": "object",
                        "description": "What the legal form means for equity: the balance sheet's equity heading, the ownership reports that apply (primary first) and the company-setup skill's ownership recipes.",
                        "properties": {
                          "family": {
                            "enum": [
                              "corporation",
                              "members",
                              "partners",
                              "owner",
                              "nonprofit",
                              "unspecified"
                            ]
                          },
                          "equityLabel": {
                            "type": "string"
                          },
                          "reports": {
                            "type": "array",
                            "items": {
                              "enum": [
                                "cap_table",
                                "capital_accounts"
                              ]
                            }
                          },
                          "recipes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "family",
                          "equityLabel",
                          "reports",
                          "recipes"
                        ]
                      },
                      "jurisdiction": {
                        "type": "string"
                      },
                      "formationDate": {
                        "type": "string",
                        "format": "date"
                      },
                      "formationDateEventId": {
                        "type": "integer"
                      },
                      "nameEventId": {
                        "type": "integer"
                      },
                      "legalNameEventId": {
                        "type": "integer"
                      },
                      "legalEntityTypeEventId": {
                        "type": "integer"
                      },
                      "jurisdictionEventId": {
                        "type": "integer"
                      },
                      "registrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "enum": [
                                "us_ein",
                                "sg_uen",
                                "ca_bn",
                                "gb_company_number"
                              ]
                            },
                            "number": {
                              "type": "string"
                            },
                            "eventId": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "kind",
                            "number",
                            "eventId"
                          ]
                        }
                      },
                      "description": {
                        "type": "string"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "line1": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]+$"
                          },
                          "line2": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "city": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]+$"
                          },
                          "region": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "postalCode": {
                            "type": "string",
                            "maxLength": 40,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "country": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          }
                        },
                        "required": [
                          "line1",
                          "city",
                          "country"
                        ],
                        "additionalProperties": false
                      },
                      "url": {
                        "type": "string",
                        "pattern": "^https?://"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "functionalCurrency": {
                        "type": "string"
                      },
                      "primaryLedgerId": {
                        "type": "string"
                      },
                      "successions": {
                        "type": "array",
                        "description": "Incorporations in place (business.incorporate), oldest first.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "eventId": {
                              "type": "integer"
                            },
                            "effectiveAt": {
                              "type": "string"
                            },
                            "previousName": {
                              "type": "string"
                            },
                            "previousLegalEntityType": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "legalEntityType": {
                              "type": "string"
                            },
                            "predecessorLedgerId": {
                              "type": "string"
                            },
                            "successorLedgerId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "eventId",
                            "effectiveAt",
                            "previousLegalEntityType",
                            "name",
                            "legalEntityType",
                            "predecessorLedgerId",
                            "successorLedgerId"
                          ]
                        }
                      },
                      "functionalCurrencyPeriods": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "currency": {
                              "type": "string"
                            },
                            "ledgerId": {
                              "type": "string"
                            },
                            "effectiveFrom": {
                              "type": "string"
                            },
                            "effectiveUntil": {
                              "type": "string"
                            },
                            "changeEventId": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "currency",
                            "ledgerId",
                            "effectiveFrom",
                            "changeEventId"
                          ]
                        }
                      },
                      "accountingFramework": {
                        "type": "object",
                        "required": [
                          "framework",
                          "reason",
                          "jurisdiction",
                          "evidenceDocumentId",
                          "evidenceDocumentCid",
                          "effectiveAt"
                        ],
                        "properties": {
                          "framework": {
                            "type": "string"
                          },
                          "edition": {
                            "type": "string"
                          },
                          "sizeRegime": {
                            "enum": [
                              "small",
                              "micro"
                            ]
                          },
                          "sizeEligibility": {
                            "type": "object",
                            "required": [
                              "basis",
                              "periodEnd"
                            ],
                            "properties": {
                              "basis": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                              },
                              "periodEnd": {
                                "type": "string",
                                "format": "date",
                                "description": "Period end the conclusion covers."
                              }
                            }
                          },
                          "reason": {
                            "type": "string"
                          },
                          "jurisdiction": {
                            "type": "string"
                          },
                          "evidenceDocumentId": {
                            "type": "string"
                          },
                          "evidenceDocumentCid": {
                            "type": "string"
                          },
                          "effectiveAt": {
                            "type": "string"
                          },
                          "eventId": {
                            "type": "integer"
                          }
                        }
                      },
                      "accountingFrameworkHistory": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "framework",
                            "reason",
                            "jurisdiction",
                            "evidenceDocumentId",
                            "evidenceDocumentCid",
                            "effectiveAt"
                          ],
                          "properties": {
                            "framework": {
                              "type": "string"
                            },
                            "edition": {
                              "type": "string"
                            },
                            "sizeRegime": {
                              "enum": [
                                "small",
                                "micro"
                              ]
                            },
                            "sizeEligibility": {
                              "type": "object",
                              "required": [
                                "basis",
                                "periodEnd"
                              ],
                              "properties": {
                                "basis": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000,
                                  "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                                },
                                "periodEnd": {
                                  "type": "string",
                                  "format": "date",
                                  "description": "Period end the conclusion covers."
                                }
                              }
                            },
                            "reason": {
                              "type": "string"
                            },
                            "jurisdiction": {
                              "type": "string"
                            },
                            "evidenceDocumentId": {
                              "type": "string"
                            },
                            "evidenceDocumentCid": {
                              "type": "string"
                            },
                            "effectiveAt": {
                              "type": "string"
                            },
                            "eventId": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "salesTaxRegistrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "registrationId": {
                              "type": "string"
                            },
                            "regime": {
                              "enum": [
                                "sg_gst",
                                "ca_gst_hst",
                                "ca_qst",
                                "ca_pst_bc",
                                "ca_pst_sk",
                                "ca_rst_mb",
                                "gb_vat"
                              ],
                              "description": "sg_gst (Singapore GST); ca_gst_hst (Canadian GST/HST), ca_qst (Quebec QST), ca_pst_bc, ca_pst_sk, ca_rst_mb (provincial sales taxes, kept apart from GST/HST); gb_vat (UK VAT). It must be a regime of the country the business is incorporated in. There is no US regime: record US state sales tax as custom codes with tax_codes.create."
                            },
                            "country": {
                              "type": "string"
                            },
                            "registrationNumber": {
                              "type": "string"
                            },
                            "province": {
                              "type": "string"
                            },
                            "effectiveFrom": {
                              "type": "string",
                              "format": "date"
                            },
                            "effectiveUntil": {
                              "type": "string",
                              "format": "date"
                            },
                            "reason": {
                              "type": "string"
                            },
                            "sourceDocumentId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "registrationId",
                            "regime",
                            "country",
                            "registrationNumber",
                            "effectiveFrom",
                            "reason",
                            "sourceDocumentId"
                          ]
                        }
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri",
                        "description": "The logo the business's share pages show."
                      },
                      "logoCid": {
                        "type": "string",
                        "description": "The CID in logoUrl."
                      },
                      "ycVerified": {
                        "type": "boolean"
                      },
                      "ycVerificationUrl": {
                        "type": "string"
                      },
                      "ycVerifiedAt": {
                        "type": "string"
                      },
                      "ycBatch": {
                        "type": "string"
                      },
                      "ycFounderName": {
                        "type": "string"
                      },
                      "ycVerificationPending": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "requestedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "url",
                          "requestedAt"
                        ]
                      },
                      "ycVerificationError": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "ycVerified"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "demo": {
                        "const": true,
                        "description": "Present only on a demo business: a fictional company, its owner's alone, that never takes a plan or reaches anyone but Economico, which it can send support requests and suggestions. Its figures are not real."
                      },
                      "demoOpenedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "On a demo business: when it was opened. Its seeded books run up to here."
                      },
                      "name": {
                        "type": "string",
                        "description": "The public name."
                      },
                      "legalName": {
                        "type": "string",
                        "description": "The registered name agreements and documents use; a project's is its owner's."
                      },
                      "legalEntityType": {
                        "enum": [
                          "unknown",
                          "llc",
                          "c_corp",
                          "s_corp",
                          "sole_proprietorship",
                          "partnership",
                          "nonprofit",
                          "unincorporated",
                          "other",
                          "private_limited_company",
                          "corporation",
                          "stock_corporation",
                          "project"
                        ]
                      },
                      "ownership": {
                        "type": "object",
                        "description": "What the legal form means for equity: the balance sheet's equity heading, the ownership reports that apply (primary first) and the company-setup skill's ownership recipes.",
                        "properties": {
                          "family": {
                            "enum": [
                              "corporation",
                              "members",
                              "partners",
                              "owner",
                              "nonprofit",
                              "unspecified"
                            ]
                          },
                          "equityLabel": {
                            "type": "string"
                          },
                          "reports": {
                            "type": "array",
                            "items": {
                              "enum": [
                                "cap_table",
                                "capital_accounts"
                              ]
                            }
                          },
                          "recipes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "family",
                          "equityLabel",
                          "reports",
                          "recipes"
                        ]
                      },
                      "jurisdiction": {
                        "type": "string"
                      },
                      "formationDate": {
                        "type": "string",
                        "format": "date"
                      },
                      "formationDateEventId": {
                        "type": "integer"
                      },
                      "nameEventId": {
                        "type": "integer"
                      },
                      "legalNameEventId": {
                        "type": "integer"
                      },
                      "legalEntityTypeEventId": {
                        "type": "integer"
                      },
                      "jurisdictionEventId": {
                        "type": "integer"
                      },
                      "registrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "enum": [
                                "us_ein",
                                "sg_uen",
                                "ca_bn",
                                "gb_company_number"
                              ]
                            },
                            "number": {
                              "type": "string"
                            },
                            "eventId": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "kind",
                            "number",
                            "eventId"
                          ]
                        }
                      },
                      "description": {
                        "type": "string"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "line1": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]+$"
                          },
                          "line2": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "city": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]+$"
                          },
                          "region": {
                            "type": "string",
                            "maxLength": 200,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "postalCode": {
                            "type": "string",
                            "maxLength": 40,
                            "pattern": "^[^\\r\\n]*$"
                          },
                          "country": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          }
                        },
                        "required": [
                          "line1",
                          "city",
                          "country"
                        ],
                        "additionalProperties": false
                      },
                      "url": {
                        "type": "string",
                        "pattern": "^https?://"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "functionalCurrency": {
                        "type": "string"
                      },
                      "primaryLedgerId": {
                        "type": "string"
                      },
                      "successions": {
                        "type": "array",
                        "description": "Incorporations in place (business.incorporate), oldest first.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "eventId": {
                              "type": "integer"
                            },
                            "effectiveAt": {
                              "type": "string"
                            },
                            "previousName": {
                              "type": "string"
                            },
                            "previousLegalEntityType": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "legalEntityType": {
                              "type": "string"
                            },
                            "predecessorLedgerId": {
                              "type": "string"
                            },
                            "successorLedgerId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "eventId",
                            "effectiveAt",
                            "previousLegalEntityType",
                            "name",
                            "legalEntityType",
                            "predecessorLedgerId",
                            "successorLedgerId"
                          ]
                        }
                      },
                      "functionalCurrencyPeriods": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "currency": {
                              "type": "string"
                            },
                            "ledgerId": {
                              "type": "string"
                            },
                            "effectiveFrom": {
                              "type": "string"
                            },
                            "effectiveUntil": {
                              "type": "string"
                            },
                            "changeEventId": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "currency",
                            "ledgerId",
                            "effectiveFrom",
                            "changeEventId"
                          ]
                        }
                      },
                      "accountingFramework": {
                        "type": "object",
                        "required": [
                          "framework",
                          "reason",
                          "jurisdiction",
                          "evidenceDocumentId",
                          "evidenceDocumentCid",
                          "effectiveAt"
                        ],
                        "properties": {
                          "framework": {
                            "type": "string"
                          },
                          "edition": {
                            "type": "string"
                          },
                          "sizeRegime": {
                            "enum": [
                              "small",
                              "micro"
                            ]
                          },
                          "sizeEligibility": {
                            "type": "object",
                            "required": [
                              "basis",
                              "periodEnd"
                            ],
                            "properties": {
                              "basis": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                              },
                              "periodEnd": {
                                "type": "string",
                                "format": "date",
                                "description": "Period end the conclusion covers."
                              }
                            }
                          },
                          "reason": {
                            "type": "string"
                          },
                          "jurisdiction": {
                            "type": "string"
                          },
                          "evidenceDocumentId": {
                            "type": "string"
                          },
                          "evidenceDocumentCid": {
                            "type": "string"
                          },
                          "effectiveAt": {
                            "type": "string"
                          },
                          "eventId": {
                            "type": "integer"
                          }
                        }
                      },
                      "accountingFrameworkHistory": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "framework",
                            "reason",
                            "jurisdiction",
                            "evidenceDocumentId",
                            "evidenceDocumentCid",
                            "effectiveAt"
                          ],
                          "properties": {
                            "framework": {
                              "type": "string"
                            },
                            "edition": {
                              "type": "string"
                            },
                            "sizeRegime": {
                              "enum": [
                                "small",
                                "micro"
                              ]
                            },
                            "sizeEligibility": {
                              "type": "object",
                              "required": [
                                "basis",
                                "periodEnd"
                              ],
                              "properties": {
                                "basis": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000,
                                  "description": "What the founder's size conclusion rests on, e.g. 'Companies Act 2006 s384A conditions met in FY2025 and FY2026'. Recorded, never computed."
                                },
                                "periodEnd": {
                                  "type": "string",
                                  "format": "date",
                                  "description": "Period end the conclusion covers."
                                }
                              }
                            },
                            "reason": {
                              "type": "string"
                            },
                            "jurisdiction": {
                              "type": "string"
                            },
                            "evidenceDocumentId": {
                              "type": "string"
                            },
                            "evidenceDocumentCid": {
                              "type": "string"
                            },
                            "effectiveAt": {
                              "type": "string"
                            },
                            "eventId": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "salesTaxRegistrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "registrationId": {
                              "type": "string"
                            },
                            "regime": {
                              "enum": [
                                "sg_gst",
                                "ca_gst_hst",
                                "ca_qst",
                                "ca_pst_bc",
                                "ca_pst_sk",
                                "ca_rst_mb",
                                "gb_vat"
                              ],
                              "description": "sg_gst (Singapore GST); ca_gst_hst (Canadian GST/HST), ca_qst (Quebec QST), ca_pst_bc, ca_pst_sk, ca_rst_mb (provincial sales taxes, kept apart from GST/HST); gb_vat (UK VAT). It must be a regime of the country the business is incorporated in. There is no US regime: record US state sales tax as custom codes with tax_codes.create."
                            },
                            "country": {
                              "type": "string"
                            },
                            "registrationNumber": {
                              "type": "string"
                            },
                            "province": {
                              "type": "string"
                            },
                            "effectiveFrom": {
                              "type": "string",
                              "format": "date"
                            },
                            "effectiveUntil": {
                              "type": "string",
                              "format": "date"
                            },
                            "reason": {
                              "type": "string"
                            },
                            "sourceDocumentId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "registrationId",
                            "regime",
                            "country",
                            "registrationNumber",
                            "effectiveFrom",
                            "reason",
                            "sourceDocumentId"
                          ]
                        }
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri",
                        "description": "The logo the business's share pages show."
                      },
                      "logoCid": {
                        "type": "string",
                        "description": "The CID in logoUrl."
                      },
                      "ycVerified": {
                        "type": "boolean"
                      },
                      "ycVerificationUrl": {
                        "type": "string"
                      },
                      "ycVerifiedAt": {
                        "type": "string"
                      },
                      "ycBatch": {
                        "type": "string"
                      },
                      "ycFounderName": {
                        "type": "string"
                      },
                      "ycVerificationPending": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "requestedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "url",
                          "requestedAt"
                        ]
                      },
                      "ycVerificationError": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "ycVerified"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "paymentId",
                      "statementId"
                    ],
                    "properties": {
                      "paymentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "statementId": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "statementId",
                      "cardBalanceAtClose",
                      "difference"
                    ],
                    "properties": {
                      "statementId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cardBalanceAtClose": {
                        "type": "string"
                      },
                      "difference": {
                        "type": "string"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "reversalId"
                    ],
                    "properties": {
                      "reversalId": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "reversalId"
                    ],
                    "properties": {
                      "reversalId": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "categoryId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "code": {
                        "type": "string",
                        "minLength": 1
                      },
                      "description": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "categoryId",
                      "name",
                      "code"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "connectionId": {
                        "type": "string"
                      },
                      "direction": {
                        "enum": [
                          "outbound",
                          "inbound"
                        ]
                      },
                      "counterparty": {
                        "type": "string"
                      },
                      "partyId": {
                        "type": "string"
                      },
                      "status": {
                        "enum": [
                          "requested",
                          "pending",
                          "active",
                          "declined",
                          "ended",
                          "refused"
                        ]
                      },
                      "note": {
                        "type": "string"
                      },
                      "requestedAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "connectionId",
                      "direction",
                      "counterparty",
                      "status",
                      "requestedAt"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "connectionId": {
                        "type": "string"
                      },
                      "direction": {
                        "enum": [
                          "outbound",
                          "inbound"
                        ]
                      },
                      "counterparty": {
                        "type": "string"
                      },
                      "partyId": {
                        "type": "string"
                      },
                      "status": {
                        "enum": [
                          "requested",
                          "pending",
                          "active",
                          "declined",
                          "ended",
                          "refused"
                        ]
                      },
                      "note": {
                        "type": "string"
                      },
                      "requestedAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "connectionId",
                      "direction",
                      "counterparty",
                      "status",
                      "requestedAt"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "connectionId": {
                        "type": "string"
                      },
                      "direction": {
                        "enum": [
                          "outbound",
                          "inbound"
                        ]
                      },
                      "counterparty": {
                        "type": "string"
                      },
                      "partyId": {
                        "type": "string"
                      },
                      "status": {
                        "enum": [
                          "requested",
                          "pending",
                          "active",
                          "declined",
                          "ended",
                          "refused"
                        ]
                      },
                      "note": {
                        "type": "string"
                      },
                      "requestedAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "connectionId",
                      "direction",
                      "counterparty",
                      "status",
                      "requestedAt"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "connectionId": {
                        "type": "string"
                      },
                      "direction": {
                        "enum": [
                          "outbound",
                          "inbound"
                        ]
                      },
                      "counterparty": {
                        "type": "string"
                      },
                      "partyId": {
                        "type": "string"
                      },
                      "status": {
                        "enum": [
                          "requested",
                          "pending",
                          "active",
                          "declined",
                          "ended",
                          "refused"
                        ]
                      },
                      "note": {
                        "type": "string"
                      },
                      "requestedAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "connectionId",
                      "direction",
                      "counterparty",
                      "status",
                      "requestedAt"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "status"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "status": {
                        "enum": [
                          "draft",
                          "offer",
                          "active",
                          "rejected",
                          "terminated",
                          "expired"
                        ]
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "id",
                      "documentId",
                      "cid",
                      "poolKey"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "poolKey": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "id",
                      "documentId",
                      "cid"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "contractId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "contractDocumentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "templateId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "templateDocumentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "partyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "reused": {
                        "type": "boolean"
                      },
                      "firstCopy": {
                        "type": "boolean"
                      },
                      "seller": {
                        "type": "string",
                        "minLength": 1
                      },
                      "tax": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "outcome": {
                            "type": "string",
                            "minLength": 1
                          },
                          "role": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "outcome"
                        ]
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "contractId",
                      "templateId",
                      "reused"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "id",
                      "documentId",
                      "cid"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "prorations": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "object",
                          "required": [
                            "cid",
                            "creditAmount",
                            "chargeAmount"
                          ],
                          "properties": {
                            "cid": {
                              "type": "string",
                              "minLength": 1
                            },
                            "creditAmount": {
                              "type": "string",
                              "minLength": 1
                            },
                            "chargeAmount": {
                              "type": "string",
                              "minLength": 1
                            },
                            "reversedBillOccurrenceId": {
                              "type": "string",
                              "minLength": 1
                            }
                          }
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "status"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "status": {
                        "enum": [
                          "draft",
                          "offer",
                          "active",
                          "rejected",
                          "terminated",
                          "expired"
                        ]
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "changeId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "adjustment": {
                        "type": "object"
                      },
                      "credit": {
                        "type": "object"
                      },
                      "bill": {
                        "type": "object"
                      }
                    },
                    "required": [
                      "changeId"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "id",
                      "documentId",
                      "cid"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "status": {
                        "const": "discarded"
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "id",
                      "status"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "endsAt": {
                        "type": "string",
                        "minLength": 1
                      },
                      "late": {
                        "type": "boolean"
                      },
                      "termsUnknown": {
                        "const": true
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "status"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "status": {
                        "enum": [
                          "draft",
                          "offer",
                          "active",
                          "rejected",
                          "terminated",
                          "expired"
                        ]
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "replacement": {
                        "type": "object",
                        "properties": {
                          "billId": {
                            "type": "string"
                          },
                          "reversedPhases": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "creditClaimId": {
                            "type": "string"
                          },
                          "creditAmount": {
                            "type": "string"
                          },
                          "appliedCredit": {
                            "type": "string"
                          },
                          "remainingCredit": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "replacement": {
                        "type": "object",
                        "properties": {
                          "billId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "reversedPhases": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "creditClaimId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "creditAmount": {
                            "type": "string",
                            "minLength": 1
                          },
                          "appliedCredit": {
                            "type": "string",
                            "minLength": 1
                          },
                          "remainingCredit": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "occurrenceId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "duplicate": {
                        "type": "boolean"
                      },
                      "evaluation": {
                        "type": "object"
                      },
                      "claimIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "claims": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "claimId",
                            "component"
                          ],
                          "properties": {
                            "claimId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "component": {
                              "type": "object",
                              "required": [
                                "originLedgerId",
                                "accountCode"
                              ],
                              "properties": {
                                "originLedgerId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "accountCode": {
                                  "type": "integer"
                                }
                              }
                            }
                          }
                        },
                        "description": "Payment-ready claim identities returned for priced-right economic phases."
                      }
                    },
                    "required": [
                      "occurrenceId",
                      "documentId",
                      "cid",
                      "duplicate",
                      "evaluation"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "decisions": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "resolved"
                    ],
                    "properties": {
                      "resolved": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 50
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "reversalId",
                      "documentId",
                      "occurrenceIds",
                      "repeated"
                    ],
                    "properties": {
                      "reversalId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "occurrenceIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "refundClaims": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "claimId",
                            "component",
                            "amount"
                          ],
                          "properties": {
                            "claimId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "component": {
                              "type": "object",
                              "required": [
                                "originLedgerId",
                                "accountCode"
                              ],
                              "properties": {
                                "originLedgerId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "accountCode": {
                                  "type": "integer"
                                }
                              }
                            },
                            "amount": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "repeated": {
                        "type": "boolean"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "status"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "status": {
                        "enum": [
                          "draft",
                          "offer",
                          "active",
                          "rejected",
                          "terminated",
                          "expired"
                        ]
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "contractId",
                      "status",
                      "reversedEvents",
                      "occurrenceIds",
                      "releases",
                      "planDigest"
                    ],
                    "properties": {
                      "contractId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "status": {
                        "const": "voided"
                      },
                      "voidId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "reversedEvents": {
                        "type": "integer"
                      },
                      "occurrenceIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "releases": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "paymentId",
                            "amount"
                          ],
                          "properties": {
                            "paymentId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "claimId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "component": {
                              "type": "object",
                              "required": [
                                "originLedgerId",
                                "accountCode"
                              ],
                              "properties": {
                                "originLedgerId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "accountCode": {
                                  "type": "integer"
                                }
                              }
                            },
                            "amount": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "recordedPayments": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "occurrenceId",
                            "sourceFactId",
                            "effectiveAt",
                            "accountCode",
                            "direction",
                            "amount"
                          ],
                          "properties": {
                            "occurrenceId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "sourceFactId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effectiveAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "accountCode": {
                              "type": "integer"
                            },
                            "direction": {
                              "enum": [
                                "debit",
                                "credit"
                              ]
                            },
                            "amount": {
                              "type": "string"
                            },
                            "partyId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "financialAccountId": {
                              "type": "string",
                              "minLength": 1
                            }
                          }
                        }
                      },
                      "planDigest": {
                        "type": "string"
                      },
                      "restores": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "preview": {
                        "const": true
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "documentId",
                      "cid"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "related": {
                        "const": true
                      }
                    },
                    "required": [
                      "related"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "disposition",
                      "source",
                      "missing"
                    ],
                    "allOf": [
                      {
                        "if": {
                          "properties": {
                            "disposition": {
                              "const": "ready"
                            }
                          }
                        },
                        "then": {
                          "required": [
                            "template",
                            "preview",
                            "termsEvidence",
                            "command"
                          ]
                        }
                      }
                    ],
                    "properties": {
                      "disposition": {
                        "enum": [
                          "ready",
                          "needs_information"
                        ]
                      },
                      "source": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance",
                          "textCid",
                          "location"
                        ],
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          },
                          "textCid": {
                            "type": "string"
                          },
                          "location": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "start",
                              "end"
                            ],
                            "properties": {
                              "start": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "end": {
                                "type": "integer",
                                "minimum": 0
                              }
                            }
                          }
                        }
                      },
                      "missing": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "template": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "documentId",
                          "cid"
                        ],
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          }
                        }
                      },
                      "preview": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "status",
                          "name",
                          "activities"
                        ],
                        "properties": {
                          "status": {
                            "const": "draft"
                          },
                          "name": {
                            "type": "string"
                          },
                          "activities": {
                            "type": "array",
                            "maxItems": 100,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "key",
                                "activityDocumentId",
                                "terms"
                              ],
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "activityDocumentId": {
                                  "type": "string"
                                },
                                "terms": {
                                  "type": "object",
                                  "maxProperties": 100,
                                  "additionalProperties": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "termsEvidence": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "activityKey",
                            "term",
                            "value",
                            "origin",
                            "pointer",
                            "documentId",
                            "cid",
                            "textCid"
                          ],
                          "properties": {
                            "activityKey": {
                              "type": "string"
                            },
                            "term": {
                              "type": "string"
                            },
                            "value": {
                              "type": "string"
                            },
                            "origin": {
                              "enum": [
                                "source",
                                "catalog"
                              ]
                            },
                            "pointer": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "documentId": {
                              "type": "string"
                            },
                            "cid": {
                              "type": "string"
                            },
                            "textCid": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        }
                      },
                      "command": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "input",
                          "source_document_id",
                          "effective_at",
                          "idempotency_key"
                        ],
                        "properties": {
                          "name": {
                            "const": "contracts.create"
                          },
                          "input": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "classification": {
                                "type": "object",
                                "maxProperties": 100,
                                "additionalProperties": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "expenseAccount": {
                                      "type": "integer"
                                    },
                                    "expenseFunction": {
                                      "type": "string"
                                    },
                                    "taxCode": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "taxTreatment": {
                                      "enum": [
                                        "exclusive",
                                        "inclusive",
                                        null
                                      ]
                                    }
                                  }
                                }
                              },
                              "lifecycle": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "term": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "index": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 9007199254740991
                                      },
                                      "startsOn": {
                                        "type": "string",
                                        "minLength": 1,
                                        "format": "date",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      "endsOn": {
                                        "type": "string",
                                        "minLength": 1,
                                        "format": "date",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      "rolling": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "everyMonths": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 120
                                              }
                                            },
                                            "required": [
                                              "everyMonths"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "everyDays": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 3660
                                              }
                                            },
                                            "required": [
                                              "everyDays"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "index",
                                      "startsOn"
                                    ]
                                  },
                                  "atTermEnd": {
                                    "enum": [
                                      "renew",
                                      "evergreen",
                                      "end",
                                      "renew_once"
                                    ]
                                  },
                                  "renewal": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "length": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "everyMonths": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 120
                                              }
                                            },
                                            "required": [
                                              "everyMonths"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "everyDays": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 3660
                                              }
                                            },
                                            "required": [
                                              "everyDays"
                                            ]
                                          }
                                        ]
                                      },
                                      "price": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "enum": [
                                                  "same",
                                                  "list"
                                                ]
                                              },
                                              "reducedLosesPrice": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "quantityTerms": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "right": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "term": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "right",
                                                        "term"
                                                      ]
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  }
                                                },
                                                "required": [
                                                  "quantityTerms"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "uplift"
                                              },
                                              "bps": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 100000
                                              },
                                              "terms": {
                                                "type": "array",
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "right": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "term": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "right",
                                                    "term"
                                                  ]
                                                },
                                                "maxItems": 100,
                                                "minItems": 1
                                              },
                                              "reducedLosesPrice": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "quantityTerms": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "right": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "term": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "right",
                                                        "term"
                                                      ]
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  }
                                                },
                                                "required": [
                                                  "quantityTerms"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "bps",
                                              "terms"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "capped"
                                              },
                                              "bps": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 100000
                                              },
                                              "terms": {
                                                "type": "array",
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "right": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "term": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "right",
                                                    "term"
                                                  ]
                                                },
                                                "maxItems": 100,
                                                "minItems": 1
                                              },
                                              "index": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "uncappedWhen": {
                                                "type": "array",
                                                "items": {
                                                  "enum": [
                                                    "quantity_reduced",
                                                    "term_shortened"
                                                  ]
                                                },
                                                "maxItems": 2,
                                                "minItems": 0
                                              },
                                              "reducedLosesPrice": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "quantityTerms": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "right": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "term": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "right",
                                                        "term"
                                                      ]
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  }
                                                },
                                                "required": [
                                                  "quantityTerms"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "bps",
                                              "terms"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "price"
                                    ]
                                  },
                                  "notice": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "days": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 366
                                      },
                                      "basis": {
                                        "enum": [
                                          "calendar",
                                          "weekdays"
                                        ]
                                      },
                                      "remindDaysBefore": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 366
                                      }
                                    },
                                    "required": [
                                      "days",
                                      "basis"
                                    ]
                                  },
                                  "cancellation": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "windows": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "from": {
                                              "enum": [
                                                "term_start",
                                                "term_end"
                                              ]
                                            },
                                            "days": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 366
                                            }
                                          },
                                          "required": [
                                            "from",
                                            "days"
                                          ]
                                        },
                                        "maxItems": 20,
                                        "minItems": 0
                                      },
                                      "onlyInWindows": {
                                        "const": true
                                      },
                                      "otherwise": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "none"
                                              }
                                            },
                                            "required": [
                                              "type"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "fee"
                                              },
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "right"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "accelerate"
                                              },
                                              "rights": {
                                                "type": "array",
                                                "items": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "maxItems": 100,
                                                "minItems": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "rights"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "windows",
                                      "otherwise"
                                    ]
                                  },
                                  "changes": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "termsChange": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "on_posting"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "after_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "next_term"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "locked_to_order"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "objection_until_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          }
                                        ]
                                      },
                                      "priceChange": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "no_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "after_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "held_for_paid_term"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "capped_at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "capPpm": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 10000000
                                              },
                                              "index": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "capPpm"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "mid_term_credit"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": []
                                  }
                                },
                                "required": [
                                  "term",
                                  "atTermEnd",
                                  "notice"
                                ]
                              },
                              "agreements": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "changes": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "termsChange": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "on_posting"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "after_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "next_term"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "locked_to_order"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "objection_until_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          }
                                        ]
                                      },
                                      "priceChange": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "no_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "after_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "held_for_paid_term"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "capped_at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "capPpm": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 10000000
                                              },
                                              "index": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "capPpm"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "mid_term_credit"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": []
                                  },
                                  "refs": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "role": {
                                          "enum": [
                                            "agreement",
                                            "order_form",
                                            "schedule",
                                            "policy"
                                          ]
                                        },
                                        "url": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "uri",
                                          "maxLength": 2048
                                        },
                                        "label": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "cid": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "method": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "kind": {
                                              "enum": [
                                                "pdf",
                                                "markdown",
                                                "html",
                                                "html_blanked",
                                                "html_extract",
                                                "embedded_json",
                                                "api_json",
                                                "text_render",
                                                "unstable"
                                              ]
                                            },
                                            "command": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 1000
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ]
                                        },
                                        "seenAt": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date",
                                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                        },
                                        "history": {
                                          "enum": [
                                            "vendor_archive",
                                            "git",
                                            "wayback"
                                          ]
                                        },
                                        "catalog": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "cid": {
                                              "type": "string",
                                              "minLength": 1
                                            }
                                          },
                                          "required": [
                                            "cid"
                                          ]
                                        },
                                        "documentId": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "role",
                                        "url",
                                        "method",
                                        "seenAt"
                                      ]
                                    },
                                    "maxItems": 20,
                                    "minItems": 1
                                  },
                                  "precedence": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "stated": {
                                        "type": "boolean"
                                      },
                                      "order": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "maxItems": 20,
                                        "minItems": 0
                                      },
                                      "orderFormWinsOn": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "maxItems": 20,
                                        "minItems": 0
                                      }
                                    },
                                    "required": [
                                      "stated"
                                    ]
                                  }
                                },
                                "required": [
                                  "refs",
                                  "precedence"
                                ]
                              },
                              "paymentTerms": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "statementClosingDay": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 31
                                  },
                                  "paymentDueDay": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 31
                                  },
                                  "autopay": {
                                    "type": "boolean",
                                    "description": "Whether the issuer is instructed to collect automatically from the paying account."
                                  },
                                  "payingAccountId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "Registered payment account; omit to clear the default."
                                  }
                                }
                              },
                              "templateDocumentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "definition": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "vendorPlan": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "catalog": {
                                        "type": "string"
                                      },
                                      "cid": {
                                        "type": "string"
                                      },
                                      "template": {
                                        "type": "string"
                                      },
                                      "relation": {
                                        "enum": [
                                          "adopted",
                                          "derived"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "cid",
                                      "template",
                                      "relation"
                                    ]
                                  },
                                  "lifecycle": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "term": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "index": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          },
                                          "startsOn": {
                                            "type": "string",
                                            "minLength": 1,
                                            "format": "date",
                                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                          },
                                          "endsOn": {
                                            "type": "string",
                                            "minLength": 1,
                                            "format": "date",
                                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                          },
                                          "rolling": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "everyMonths": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 120
                                                  }
                                                },
                                                "required": [
                                                  "everyMonths"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "everyDays": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 3660
                                                  }
                                                },
                                                "required": [
                                                  "everyDays"
                                                ]
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "index",
                                          "startsOn"
                                        ]
                                      },
                                      "atTermEnd": {
                                        "enum": [
                                          "renew",
                                          "evergreen",
                                          "end",
                                          "renew_once"
                                        ]
                                      },
                                      "renewal": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "length": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "everyMonths": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 120
                                                  }
                                                },
                                                "required": [
                                                  "everyMonths"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "everyDays": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 3660
                                                  }
                                                },
                                                "required": [
                                                  "everyDays"
                                                ]
                                              }
                                            ]
                                          },
                                          "price": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "enum": [
                                                      "same",
                                                      "list"
                                                    ]
                                                  },
                                                  "reducedLosesPrice": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "quantityTerms": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "additionalProperties": false,
                                                          "properties": {
                                                            "right": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            },
                                                            "term": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "right",
                                                            "term"
                                                          ]
                                                        },
                                                        "maxItems": 100,
                                                        "minItems": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "quantityTerms"
                                                    ]
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "uplift"
                                                  },
                                                  "bps": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 100000
                                                  },
                                                  "terms": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "right": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "term": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "right",
                                                        "term"
                                                      ]
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  },
                                                  "reducedLosesPrice": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "quantityTerms": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "additionalProperties": false,
                                                          "properties": {
                                                            "right": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            },
                                                            "term": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "right",
                                                            "term"
                                                          ]
                                                        },
                                                        "maxItems": 100,
                                                        "minItems": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "quantityTerms"
                                                    ]
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "bps",
                                                  "terms"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "capped"
                                                  },
                                                  "bps": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 100000
                                                  },
                                                  "terms": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "right": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "term": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "right",
                                                        "term"
                                                      ]
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  },
                                                  "index": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "uncappedWhen": {
                                                    "type": "array",
                                                    "items": {
                                                      "enum": [
                                                        "quantity_reduced",
                                                        "term_shortened"
                                                      ]
                                                    },
                                                    "maxItems": 2,
                                                    "minItems": 0
                                                  },
                                                  "reducedLosesPrice": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "quantityTerms": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "additionalProperties": false,
                                                          "properties": {
                                                            "right": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            },
                                                            "term": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "right",
                                                            "term"
                                                          ]
                                                        },
                                                        "maxItems": 100,
                                                        "minItems": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "quantityTerms"
                                                    ]
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "bps",
                                                  "terms"
                                                ]
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "price"
                                        ]
                                      },
                                      "notice": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "days": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 366
                                          },
                                          "basis": {
                                            "enum": [
                                              "calendar",
                                              "weekdays"
                                            ]
                                          },
                                          "remindDaysBefore": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 366
                                          }
                                        },
                                        "required": [
                                          "days",
                                          "basis"
                                        ]
                                      },
                                      "cancellation": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "windows": {
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "from": {
                                                  "enum": [
                                                    "term_start",
                                                    "term_end"
                                                  ]
                                                },
                                                "days": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 366
                                                }
                                              },
                                              "required": [
                                                "from",
                                                "days"
                                              ]
                                            },
                                            "maxItems": 20,
                                            "minItems": 0
                                          },
                                          "onlyInWindows": {
                                            "const": true
                                          },
                                          "otherwise": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "none"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "fee"
                                                  },
                                                  "right": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "right"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "type": {
                                                    "const": "accelerate"
                                                  },
                                                  "rights": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "rights"
                                                ]
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "windows",
                                          "otherwise"
                                        ]
                                      },
                                      "changes": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "termsChange": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "on_posting"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "after_notice"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "noticeDays": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 366
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "noticeDays"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "next_term"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "at_renewal"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "locked_to_order"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "objection_until_renewal"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              }
                                            ]
                                          },
                                          "priceChange": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "no_notice"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "after_notice"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "noticeDays": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 366
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "noticeDays"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "held_for_paid_term"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "noticeDays": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 366
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "noticeDays"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "at_renewal"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "capped_at_renewal"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "capPpm": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 10000000
                                                  },
                                                  "index": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "capPpm"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "mid_term_credit"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              }
                                            ]
                                          }
                                        },
                                        "required": []
                                      }
                                    },
                                    "required": [
                                      "term",
                                      "atTermEnd",
                                      "notice"
                                    ]
                                  },
                                  "agreements": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "changes": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "termsChange": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "on_posting"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "after_notice"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "noticeDays": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 366
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "noticeDays"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "next_term"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "at_renewal"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "locked_to_order"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "objection_until_renewal"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              }
                                            ]
                                          },
                                          "priceChange": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "no_notice"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "after_notice"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "noticeDays": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 366
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "noticeDays"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "held_for_paid_term"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "noticeDays": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 366
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "noticeDays"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "at_renewal"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "capped_at_renewal"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "capPpm": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 10000000
                                                  },
                                                  "index": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule",
                                                  "capPpm"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "rule": {
                                                    "const": "mid_term_credit"
                                                  },
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "rule"
                                                ]
                                              }
                                            ]
                                          }
                                        },
                                        "required": []
                                      },
                                      "refs": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "key": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "role": {
                                              "enum": [
                                                "agreement",
                                                "order_form",
                                                "schedule",
                                                "policy"
                                              ]
                                            },
                                            "url": {
                                              "type": "string",
                                              "minLength": 1,
                                              "format": "uri",
                                              "maxLength": 2048
                                            },
                                            "label": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "cid": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "method": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "pdf",
                                                    "markdown",
                                                    "html",
                                                    "html_blanked",
                                                    "html_extract",
                                                    "embedded_json",
                                                    "api_json",
                                                    "text_render",
                                                    "unstable"
                                                  ]
                                                },
                                                "command": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 1000
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ]
                                            },
                                            "seenAt": {
                                              "type": "string",
                                              "minLength": 1,
                                              "format": "date",
                                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                            },
                                            "history": {
                                              "enum": [
                                                "vendor_archive",
                                                "git",
                                                "wayback"
                                              ]
                                            },
                                            "catalog": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "cid": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "cid"
                                              ]
                                            },
                                            "documentId": {
                                              "type": "string",
                                              "minLength": 1
                                            }
                                          },
                                          "required": [
                                            "key",
                                            "role",
                                            "url",
                                            "method",
                                            "seenAt"
                                          ]
                                        },
                                        "maxItems": 20,
                                        "minItems": 1
                                      },
                                      "precedence": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "stated": {
                                            "type": "boolean"
                                          },
                                          "order": {
                                            "type": "array",
                                            "items": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "maxItems": 20,
                                            "minItems": 0
                                          },
                                          "orderFormWinsOn": {
                                            "type": "array",
                                            "items": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "maxItems": 20,
                                            "minItems": 0
                                          }
                                        },
                                        "required": [
                                          "stated"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "refs",
                                      "precedence"
                                    ]
                                  },
                                  "model": {
                                    "const": "priced-rights-v1"
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plan": {
                                    "enum": [
                                      "on_sale",
                                      "off_sale"
                                    ]
                                  },
                                  "parties": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "minItems": 1,
                                    "maxItems": 100
                                  },
                                  "partyCategories": {
                                    "type": "object",
                                    "maxProperties": 100,
                                    "additionalProperties": {
                                      "type": "array",
                                      "items": {
                                        "enum": [
                                          "customer",
                                          "vendor",
                                          "founder",
                                          "investor",
                                          "provider",
                                          "employee"
                                        ]
                                      },
                                      "minItems": 0,
                                      "maxItems": 6
                                    }
                                  },
                                  "ledgers": {
                                    "type": "object",
                                    "maxProperties": 100,
                                    "additionalProperties": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "classification": {
                                          "enum": [
                                            "gaap",
                                            "contractual",
                                            "operational",
                                            "ownership",
                                            "planning"
                                          ]
                                        },
                                        "unitKind": {
                                          "enum": [
                                            "currency",
                                            "share",
                                            "usage",
                                            "credit",
                                            "right",
                                            "token",
                                            "other"
                                          ]
                                        },
                                        "unitCode": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "decimals": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 18
                                        },
                                        "accountTemplate": {
                                          "enum": [
                                            "gaap_startup",
                                            "contract_flow",
                                            "capacity",
                                            "meter",
                                            "entitlement",
                                            "issued_instrument"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "classification",
                                        "unitKind",
                                        "unitCode",
                                        "decimals",
                                        "accountTemplate"
                                      ]
                                    }
                                  },
                                  "activities": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "activityDocumentId": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "partyRole": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "ledgers": {
                                          "type": "object",
                                          "maxProperties": 100,
                                          "additionalProperties": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "terms": {
                                          "type": "object",
                                          "maxProperties": 100,
                                          "additionalProperties": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "activityDocumentId",
                                        "partyRole"
                                      ]
                                    },
                                    "minItems": 1,
                                    "maxItems": 100
                                  },
                                  "consequences": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "sourceRights": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "minItems": 1,
                                          "maxItems": 100
                                        },
                                        "rule": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "grant_capacity"
                                                },
                                                "capacityLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "quantity": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "expiresAtTerm": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "capacityLedger",
                                                "quantity",
                                                "expiresAtTerm"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "consume_capacity"
                                                },
                                                "capacityLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "quantity": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "grantOccurrenceFact": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "overageRight": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "capacityLedger",
                                                "quantity",
                                                "grantOccurrenceFact"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "expire_capacity"
                                                },
                                                "capacityLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "valueLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "capacityLedger"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "minimum"
                                                },
                                                "eligibleRights": {
                                                  "type": "array",
                                                  "items": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "minItems": 1,
                                                  "maxItems": 100
                                                },
                                                "minimum": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "currencyTerm": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "completeThroughFact": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "eligibleRights",
                                                "minimum",
                                                "currencyTerm",
                                                "completeThroughFact"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "refund_unearned"
                                                },
                                                "monetaryLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "taxClaimFact": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "monetaryLedger",
                                                "amount"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "profit_allocation"
                                                },
                                                "result": {
                                                  "enum": [
                                                    "profit",
                                                    "loss"
                                                  ]
                                                },
                                                "monetaryLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "ownershipLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "completeThroughFact": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "monetaryLedger",
                                                "ownershipLedger",
                                                "amount",
                                                "completeThroughFact"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "profit_allocation"
                                                },
                                                "result": {
                                                  "enum": [
                                                    "profit",
                                                    "loss"
                                                  ]
                                                },
                                                "monetaryLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "ownershipBasis": {
                                                  "const": "agreement"
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "completeThroughFact": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "monetaryLedger",
                                                "ownershipBasis",
                                                "amount",
                                                "completeThroughFact"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "close_draws"
                                                },
                                                "monetaryLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "completeThroughFact": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "monetaryLedger",
                                                "completeThroughFact"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "authorize_units"
                                                },
                                                "unitsLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "quantity": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "unitsLedger",
                                                "quantity"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "issue_units"
                                                },
                                                "capitalAllocation": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "shareCapital": {
                                                      "type": "string",
                                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                    },
                                                    "sharePremium": {
                                                      "type": "string",
                                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "shareCapital",
                                                    "sharePremium"
                                                  ]
                                                },
                                                "unitsLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "quantity": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "consideration": {
                                                  "anyOf": [
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "money"
                                                        },
                                                        "amount": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "currencyTerm": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "recognition": {
                                                          "enum": [
                                                            "unconditional_obligation",
                                                            "condition_satisfied"
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "amount",
                                                        "currencyTerm",
                                                        "recognition"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "units"
                                                        },
                                                        "quantity": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "ledger": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "quantity",
                                                        "ledger"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "claim"
                                                        },
                                                        "claimFact": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "amount": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "currencyTerm": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "claimFact",
                                                        "amount",
                                                        "currencyTerm"
                                                      ]
                                                    }
                                                  ]
                                                },
                                                "restricted": {
                                                  "type": "boolean"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "unitsLedger",
                                                "quantity",
                                                "consideration",
                                                "restricted"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "capital_contribution"
                                                },
                                                "consideration": {
                                                  "anyOf": [
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "money"
                                                        },
                                                        "amount": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "currencyTerm": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "recognition": {
                                                          "enum": [
                                                            "unconditional_obligation",
                                                            "condition_satisfied"
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "amount",
                                                        "currencyTerm",
                                                        "recognition"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "units"
                                                        },
                                                        "quantity": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "ledger": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "quantity",
                                                        "ledger"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "claim"
                                                        },
                                                        "claimFact": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "amount": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "currencyTerm": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "claimFact",
                                                        "amount",
                                                        "currencyTerm"
                                                      ]
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "consideration"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "financing_commitment"
                                                },
                                                "consideration": {
                                                  "anyOf": [
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "money"
                                                        },
                                                        "amount": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "currencyTerm": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "recognition": {
                                                          "enum": [
                                                            "unconditional_obligation",
                                                            "condition_satisfied"
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "amount",
                                                        "currencyTerm",
                                                        "recognition"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "units"
                                                        },
                                                        "quantity": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "ledger": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "quantity",
                                                        "ledger"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "type": {
                                                          "const": "claim"
                                                        },
                                                        "claimFact": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "amount": {
                                                          "type": "string",
                                                          "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                        },
                                                        "currencyTerm": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "claimFact",
                                                        "amount",
                                                        "currencyTerm"
                                                      ]
                                                    }
                                                  ]
                                                },
                                                "liability": {
                                                  "const": "owner_advance"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "consideration"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "capital_distribution"
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "amount"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "owner_draw"
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "amount"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "vest_units"
                                                },
                                                "unitsLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "quantity": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "grantOccurrenceFact": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "unitsLedger",
                                                "quantity",
                                                "grantOccurrenceFact"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "vest_units"
                                                },
                                                "unitsLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "quantity": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "grantConsequence": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "unitsLedger",
                                                "quantity",
                                                "grantConsequence"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "convert_claim"
                                                },
                                                "claimFact": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                },
                                                "currencyTerm": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "monetaryLedger": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "equityAccount": {
                                                  "enum": [
                                                    3100,
                                                    3110,
                                                    3120
                                                  ]
                                                },
                                                "units": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "ledger": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "quantity": {
                                                      "type": "string",
                                                      "pattern": "^(term|fact):[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
                                                    },
                                                    "restricted": {
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": [
                                                    "ledger",
                                                    "quantity",
                                                    "restricted"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "claimFact",
                                                "amount",
                                                "currencyTerm",
                                                "monetaryLedger",
                                                "equityAccount"
                                              ]
                                            }
                                          ]
                                        },
                                        "trigger": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "transition"
                                                },
                                                "action": {
                                                  "enum": [
                                                    "accept",
                                                    "cancel",
                                                    "terminate"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "action"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "exercise"
                                                },
                                                "activityKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "activityKey"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "type": {
                                                  "const": "period_close"
                                                },
                                                "schedule": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "startTerm": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "anchorTerm": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "endTerm": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "everyMonths": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 120
                                                    },
                                                    "timing": {
                                                      "enum": [
                                                        "start",
                                                        "end"
                                                      ]
                                                    },
                                                    "offsetDays": {
                                                      "type": "integer",
                                                      "minimum": -365,
                                                      "maximum": 365
                                                    },
                                                    "serviceEvidence": {
                                                      "const": "elapsed_time"
                                                    }
                                                  },
                                                  "required": [
                                                    "startTerm",
                                                    "everyMonths",
                                                    "timing",
                                                    "offsetDays"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "schedule"
                                              ]
                                            }
                                          ]
                                        },
                                        "evidence": {
                                          "type": "array",
                                          "items": {
                                            "enum": [
                                              "acceptance",
                                              "economic",
                                              "service"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 100
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "sourceRights",
                                        "trigger",
                                        "rule",
                                        "evidence"
                                      ]
                                    },
                                    "minItems": 0,
                                    "maxItems": 100
                                  },
                                  "creditPools": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "lots": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "eligibleRights": {
                                                "type": "array",
                                                "items": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "minItems": 1,
                                                "maxItems": 100
                                              }
                                            },
                                            "required": [
                                              "right",
                                              "eligibleRights"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 20
                                        },
                                        "drawAt": {
                                          "enum": [
                                            "recognition",
                                            "billing"
                                          ]
                                        },
                                        "drawOrder": {
                                          "type": "array",
                                          "items": {
                                            "enum": [
                                              "expiry",
                                              "granted_first",
                                              "bought_first",
                                              "narrowest_scope",
                                              "oldest"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 5
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "lots",
                                        "drawAt",
                                        "drawOrder"
                                      ]
                                    },
                                    "minItems": 1,
                                    "maxItems": 20
                                  }
                                },
                                "required": [
                                  "model",
                                  "name",
                                  "parties",
                                  "activities"
                                ]
                              },
                              "parties": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "maxProperties": 100
                              },
                              "terms": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "maxProperties": 100
                                },
                                "maxProperties": 100
                              },
                              "ledgerBindings": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "maxProperties": 100,
                                "description": "Ledger alias → existing ledger id. Every GAAP alias needs one. A business starts with its selected functional-currency ledger (USD only when omitted at initialization); binding a GAAP alias to another currency's canonical id (led_ + the zero-padded ISO 4217 numeric code, e.g. led_00000000000000000000000978 for EUR) opens that ledger with this contract, even while it is a draft."
                              },
                              "sourceDocumentIds": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "maxItems": 100
                              },
                              "concession": {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "A concession offer this contract takes (concessions.create_offer), by `offerId` or by the `code` the customer typed: its discount becomes the terms of each right's `concession` reduction, from the right's start for the offer's months. `email` is the customer's address the offer is assigned to, or that its eligibility checks.",
                                "properties": {
                                  "offerId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "code": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "email": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                }
                              }
                            },
                            "required": [
                              "parties"
                            ]
                          },
                          "source_document_id": {
                            "type": "string"
                          },
                          "effective_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "idempotency_key": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "disposition",
                      "source",
                      "missing"
                    ],
                    "allOf": [
                      {
                        "if": {
                          "properties": {
                            "disposition": {
                              "const": "ready"
                            }
                          }
                        },
                        "then": {
                          "required": [
                            "contract",
                            "preview",
                            "termsEvidence",
                            "command"
                          ]
                        }
                      }
                    ],
                    "properties": {
                      "disposition": {
                        "enum": [
                          "ready",
                          "needs_information"
                        ]
                      },
                      "source": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance",
                          "textCid",
                          "location"
                        ],
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          },
                          "textCid": {
                            "type": "string"
                          },
                          "location": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "start",
                              "end"
                            ],
                            "properties": {
                              "start": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "end": {
                                "type": "integer",
                                "minimum": 0
                              }
                            }
                          }
                        }
                      },
                      "missing": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "contract": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "documentId",
                          "cid"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          }
                        }
                      },
                      "preview": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "status",
                          "name",
                          "activities"
                        ],
                        "properties": {
                          "status": {
                            "enum": [
                              "draft",
                              "offer",
                              "active"
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "activities": {
                            "type": "array",
                            "maxItems": 100,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "key",
                                "activityDocumentId",
                                "terms"
                              ],
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "activityDocumentId": {
                                  "type": "string"
                                },
                                "terms": {
                                  "type": "object",
                                  "maxProperties": 100,
                                  "additionalProperties": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "termsEvidence": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "activityKey",
                            "term",
                            "value",
                            "origin",
                            "pointer",
                            "documentId",
                            "cid",
                            "textCid"
                          ],
                          "properties": {
                            "activityKey": {
                              "type": "string"
                            },
                            "term": {
                              "type": "string"
                            },
                            "value": {
                              "type": "string"
                            },
                            "origin": {
                              "enum": [
                                "source",
                                "contract"
                              ]
                            },
                            "pointer": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "documentId": {
                              "type": "string"
                            },
                            "cid": {
                              "type": "string"
                            },
                            "textCid": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        }
                      },
                      "command": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "input",
                          "source_document_id",
                          "effective_at",
                          "idempotency_key"
                        ],
                        "properties": {
                          "name": {
                            "const": "contracts.amend"
                          },
                          "input": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "contractId",
                              "expectedDocumentId",
                              "effectiveAt",
                              "acceptanceEvidence"
                            ],
                            "properties": {
                              "lifecycle": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "term": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "index": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 9007199254740991
                                      },
                                      "startsOn": {
                                        "type": "string",
                                        "minLength": 1,
                                        "format": "date",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      "endsOn": {
                                        "type": "string",
                                        "minLength": 1,
                                        "format": "date",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      "rolling": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "everyMonths": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 120
                                              }
                                            },
                                            "required": [
                                              "everyMonths"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "everyDays": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 3660
                                              }
                                            },
                                            "required": [
                                              "everyDays"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "index",
                                      "startsOn"
                                    ]
                                  },
                                  "atTermEnd": {
                                    "enum": [
                                      "renew",
                                      "evergreen",
                                      "end",
                                      "renew_once"
                                    ]
                                  },
                                  "renewal": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "length": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "everyMonths": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 120
                                              }
                                            },
                                            "required": [
                                              "everyMonths"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "everyDays": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 3660
                                              }
                                            },
                                            "required": [
                                              "everyDays"
                                            ]
                                          }
                                        ]
                                      },
                                      "price": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "enum": [
                                                  "same",
                                                  "list"
                                                ]
                                              },
                                              "reducedLosesPrice": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "quantityTerms": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "right": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "term": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "right",
                                                        "term"
                                                      ]
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  }
                                                },
                                                "required": [
                                                  "quantityTerms"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "uplift"
                                              },
                                              "bps": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 100000
                                              },
                                              "terms": {
                                                "type": "array",
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "right": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "term": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "right",
                                                    "term"
                                                  ]
                                                },
                                                "maxItems": 100,
                                                "minItems": 1
                                              },
                                              "reducedLosesPrice": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "quantityTerms": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "right": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "term": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "right",
                                                        "term"
                                                      ]
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  }
                                                },
                                                "required": [
                                                  "quantityTerms"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "bps",
                                              "terms"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "capped"
                                              },
                                              "bps": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 100000
                                              },
                                              "terms": {
                                                "type": "array",
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "right": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "term": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "right",
                                                    "term"
                                                  ]
                                                },
                                                "maxItems": 100,
                                                "minItems": 1
                                              },
                                              "index": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "uncappedWhen": {
                                                "type": "array",
                                                "items": {
                                                  "enum": [
                                                    "quantity_reduced",
                                                    "term_shortened"
                                                  ]
                                                },
                                                "maxItems": 2,
                                                "minItems": 0
                                              },
                                              "reducedLosesPrice": {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "properties": {
                                                  "quantityTerms": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "properties": {
                                                        "right": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "term": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "right",
                                                        "term"
                                                      ]
                                                    },
                                                    "maxItems": 100,
                                                    "minItems": 1
                                                  }
                                                },
                                                "required": [
                                                  "quantityTerms"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "bps",
                                              "terms"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "price"
                                    ]
                                  },
                                  "notice": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "days": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 366
                                      },
                                      "basis": {
                                        "enum": [
                                          "calendar",
                                          "weekdays"
                                        ]
                                      },
                                      "remindDaysBefore": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 366
                                      }
                                    },
                                    "required": [
                                      "days",
                                      "basis"
                                    ]
                                  },
                                  "cancellation": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "windows": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "from": {
                                              "enum": [
                                                "term_start",
                                                "term_end"
                                              ]
                                            },
                                            "days": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 366
                                            }
                                          },
                                          "required": [
                                            "from",
                                            "days"
                                          ]
                                        },
                                        "maxItems": 20,
                                        "minItems": 0
                                      },
                                      "onlyInWindows": {
                                        "const": true
                                      },
                                      "otherwise": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "none"
                                              }
                                            },
                                            "required": [
                                              "type"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "fee"
                                              },
                                              "right": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "right"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "type": {
                                                "const": "accelerate"
                                              },
                                              "rights": {
                                                "type": "array",
                                                "items": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "maxItems": 100,
                                                "minItems": 1
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "rights"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "windows",
                                      "otherwise"
                                    ]
                                  },
                                  "changes": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "termsChange": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "on_posting"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "after_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "next_term"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "locked_to_order"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "objection_until_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          }
                                        ]
                                      },
                                      "priceChange": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "no_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "after_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "held_for_paid_term"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "capped_at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "capPpm": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 10000000
                                              },
                                              "index": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "capPpm"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "mid_term_credit"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": []
                                  }
                                },
                                "required": [
                                  "atTermEnd",
                                  "notice"
                                ]
                              },
                              "agreements": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "changes": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "termsChange": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "on_posting"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "after_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "next_term"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "locked_to_order"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "objection_until_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          }
                                        ]
                                      },
                                      "priceChange": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "no_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "after_notice"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "held_for_paid_term"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "noticeDays": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 366
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "noticeDays"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "capped_at_renewal"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "capPpm": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 10000000
                                              },
                                              "index": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule",
                                              "capPpm"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "rule": {
                                                "const": "mid_term_credit"
                                              },
                                              "from": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "rule"
                                            ]
                                          }
                                        ]
                                      }
                                    },
                                    "required": []
                                  },
                                  "refs": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "role": {
                                          "enum": [
                                            "agreement",
                                            "order_form",
                                            "schedule",
                                            "policy"
                                          ]
                                        },
                                        "url": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "uri",
                                          "maxLength": 2048
                                        },
                                        "label": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "cid": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "method": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "kind": {
                                              "enum": [
                                                "pdf",
                                                "markdown",
                                                "html",
                                                "html_blanked",
                                                "html_extract",
                                                "embedded_json",
                                                "api_json",
                                                "text_render",
                                                "unstable"
                                              ]
                                            },
                                            "command": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 1000
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ]
                                        },
                                        "seenAt": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date",
                                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                        },
                                        "history": {
                                          "enum": [
                                            "vendor_archive",
                                            "git",
                                            "wayback"
                                          ]
                                        },
                                        "catalog": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "properties": {
                                            "cid": {
                                              "type": "string",
                                              "minLength": 1
                                            }
                                          },
                                          "required": [
                                            "cid"
                                          ]
                                        },
                                        "documentId": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "role",
                                        "url",
                                        "method",
                                        "seenAt"
                                      ]
                                    },
                                    "maxItems": 20,
                                    "minItems": 1
                                  },
                                  "precedence": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "stated": {
                                        "type": "boolean"
                                      },
                                      "order": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "maxItems": 20,
                                        "minItems": 0
                                      },
                                      "orderFormWinsOn": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "maxItems": 20,
                                        "minItems": 0
                                      }
                                    },
                                    "required": [
                                      "stated"
                                    ]
                                  }
                                },
                                "required": [
                                  "refs",
                                  "precedence"
                                ]
                              },
                              "paymentTerms": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "statementClosingDay": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 31
                                  },
                                  "paymentDueDay": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 31
                                  },
                                  "autopay": {
                                    "type": "boolean",
                                    "description": "Whether the issuer is instructed to collect automatically from the paying account."
                                  },
                                  "payingAccountId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "Registered payment account; omit to clear the default."
                                  }
                                }
                              },
                              "contractId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "expectedDocumentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "effectiveAt": {
                                "type": "string",
                                "minLength": 1,
                                "format": "date-time"
                              },
                              "terms": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                }
                              },
                              "proration": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "basis",
                                    "sourceFactId"
                                  ],
                                  "properties": {
                                    "basis": {
                                      "enum": [
                                        "actual_days",
                                        "elapsed",
                                        "days_365",
                                        "days_30",
                                        "stated"
                                      ]
                                    },
                                    "sourceFactId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "resetBillingAnchor": {
                                      "const": true
                                    },
                                    "creditDisposition": {
                                      "const": "refund"
                                    },
                                    "creditAmount": {
                                      "type": "string",
                                      "pattern": "^[0-9]+$"
                                    },
                                    "chargeAmount": {
                                      "type": "string",
                                      "pattern": "^[0-9]+$"
                                    }
                                  }
                                }
                              },
                              "sourceDocumentIds": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "maxItems": 100
                              },
                              "acceptanceEvidence": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 20,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "kind",
                                    "ref"
                                  ],
                                  "properties": {
                                    "kind": {
                                      "enum": [
                                        "tap_message",
                                        "x402_receipt",
                                        "chain_tx",
                                        "signed_doc",
                                        "stripe_object",
                                        "other"
                                      ]
                                    },
                                    "ref": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "signer": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  }
                                }
                              }
                            }
                          },
                          "source_document_id": {
                            "type": "string"
                          },
                          "effective_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "idempotency_key": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "ingestionId": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "status": {
                        "enum": [
                          "awaiting_upload",
                          "queued",
                          "processing",
                          "completed",
                          "failed"
                        ]
                      },
                      "source": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance"
                        ]
                      },
                      "expenseTargets": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 20,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "contractId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "activityKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": [
                            "contractId",
                            "activityKey"
                          ]
                        }
                      },
                      "mode": {
                        "enum": [
                          "propose",
                          "auto_record"
                        ]
                      },
                      "recordingPolicy": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "minimumConfidencePercent": {
                            "type": "integer",
                            "minimum": 60,
                            "maximum": 100
                          },
                          "fundingAccounts": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "financialAccountId",
                                "currency",
                                "last4",
                                "kind",
                                "glAccountCode"
                              ],
                              "properties": {
                                "financialAccountId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "last4": {
                                  "type": "string",
                                  "pattern": "^[0-9]{4}$"
                                },
                                "kind": {
                                  "enum": [
                                    "checking",
                                    "savings",
                                    "card",
                                    "wallet",
                                    "other"
                                  ]
                                },
                                "glAccountCode": {
                                  "enum": [
                                    1110,
                                    1310,
                                    1410,
                                    2190,
                                    2135
                                  ]
                                },
                                "ownerPartyId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "providerPartyId": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            }
                          },
                          "targets": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "contractId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "activityKey": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "cid": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              "required": [
                                "contractId",
                                "activityKey",
                                "cid"
                              ]
                            }
                          }
                        },
                        "required": [
                          "minimumConfidencePercent",
                          "targets"
                        ]
                      },
                      "execution": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "status": {
                            "enum": [
                              "pending",
                              "recorded",
                              "already_recorded",
                              "needs_review"
                            ]
                          },
                          "proposalRevision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8
                          },
                          "commandId": {
                            "type": "string",
                            "description": "Actual ordinary financial command receipt."
                          },
                          "occurrenceId": {
                            "type": "string",
                            "description": "An already recorded matching economic fact."
                          },
                          "reason": {
                            "type": "string",
                            "description": "Why automatic recording requires review."
                          }
                        },
                        "required": [
                          "status",
                          "proposalRevision"
                        ],
                        "description": "Durable financial recording disposition and actual ordinary command receipt reference."
                      },
                      "proposal": {
                        "type": "object",
                        "additionalProperties": false,
                        "description": "Frozen source-backed expense proposal. Proposal generation creates no financial entries.",
                        "required": [
                          "disposition",
                          "source",
                          "missing",
                          "lines"
                        ],
                        "properties": {
                          "disposition": {
                            "enum": [
                              "ready",
                              "needs_information",
                              "duplicate",
                              "unsupported"
                            ]
                          },
                          "source": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "documentId",
                              "cid"
                            ]
                          },
                          "missing": {
                            "type": "array",
                            "maxItems": 100,
                            "items": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "lines": {
                            "type": "array",
                            "maxItems": 500,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "index": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                }
                              },
                              "required": [
                                "index",
                                "description",
                                "amountMinor"
                              ]
                            }
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^[0-9]+$"
                          },
                          "matchedOccurrenceId": {
                            "type": "string",
                            "minLength": 1,
                            "description": "An existing matching economic fact."
                          },
                          "contract": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "contractId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "contractId",
                              "documentId",
                              "cid"
                            ]
                          },
                          "command": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "Complete ordinary public command envelope; present only when ready.",
                                "required": [
                                  "name",
                                  "input",
                                  "source_document_id",
                                  "effective_at",
                                  "idempotency_key"
                                ],
                                "properties": {
                                  "name": {
                                    "const": "contracts.record"
                                  },
                                  "source_document_id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effective_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date-time"
                                  },
                                  "idempotency_key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 256
                                  },
                                  "input": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "contractId",
                                      "activityKey",
                                      "occurrenceKey",
                                      "sourceFactId",
                                      "effectiveAt",
                                      "facts",
                                      "evidence"
                                    ],
                                    "properties": {
                                      "contractId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "activityKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "occurrenceKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "sourceFactId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "effectiveAt": {
                                        "type": "string",
                                        "minLength": 1,
                                        "format": "date-time"
                                      },
                                      "phase": {
                                        "const": "billing"
                                      },
                                      "obligationKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "facts": {
                                        "type": "object",
                                        "maxProperties": 100,
                                        "additionalProperties": {
                                          "type": "string"
                                        }
                                      },
                                      "evidence": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "service"
                                        ],
                                        "properties": {
                                          "billing": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 1,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "const": "other"
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "ref"
                                              ]
                                            }
                                          },
                                          "service": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 1,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "const": "other"
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "ref"
                                              ]
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "Complete ordinary public command envelope; present only when ready.",
                                "required": [
                                  "name",
                                  "input",
                                  "source_document_id",
                                  "effective_at",
                                  "idempotency_key"
                                ],
                                "properties": {
                                  "name": {
                                    "const": "receipts.record"
                                  },
                                  "source_document_id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effective_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date-time"
                                  },
                                  "idempotency_key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 256
                                  },
                                  "input": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "billing",
                                      "payment"
                                    ],
                                    "properties": {
                                      "processing": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "rail",
                                          "netAmount",
                                          "evidence"
                                        ],
                                        "properties": {
                                          "rail": {
                                            "enum": [
                                              "ach",
                                              "ach_same_day",
                                              "fedwire",
                                              "rtp",
                                              "sepa",
                                              "sepa_instant",
                                              "swift",
                                              "onchain",
                                              "internal",
                                              "card"
                                            ]
                                          },
                                          "netAmount": {
                                            "type": "string",
                                            "pattern": "^(0|-?[1-9][0-9]*)$"
                                          },
                                          "feeFacts": {
                                            "type": "object",
                                            "maxProperties": 20,
                                            "additionalProperties": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]*)$"
                                            }
                                          },
                                          "evidence": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 20,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "kind",
                                                "ref"
                                              ],
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "tap_message",
                                                    "x402_receipt",
                                                    "chain_tx",
                                                    "signed_doc",
                                                    "stripe_object",
                                                    "other"
                                                  ]
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "signer": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "billing": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "contractId",
                                          "activityKey",
                                          "occurrenceKey",
                                          "sourceFactId",
                                          "effectiveAt",
                                          "phase"
                                        ],
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "obligationKey": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "obligationKey"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "period": {
                                                "type": "object",
                                                "properties": {
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "through": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "from",
                                                  "through"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "period"
                                            ]
                                          }
                                        ],
                                        "properties": {
                                          "contractId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "activityKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "occurrenceKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "obligationKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "sourceFactId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "effectiveAt": {
                                            "type": "string",
                                            "format": "date-time"
                                          },
                                          "phase": {
                                            "const": "billing"
                                          },
                                          "dueDate": {
                                            "type": "string",
                                            "format": "date"
                                          },
                                          "exchangeRate": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "base",
                                              "quote",
                                              "date",
                                              "numerator",
                                              "denominator",
                                              "evidence"
                                            ],
                                            "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                            "properties": {
                                              "base": {
                                                "type": "string",
                                                "pattern": "^[A-Z]{3}$"
                                              },
                                              "quote": {
                                                "type": "string",
                                                "pattern": "^[A-Z]{3}$"
                                              },
                                              "date": {
                                                "type": "string",
                                                "format": "date"
                                              },
                                              "numerator": {
                                                "type": "string",
                                                "pattern": "^[1-9][0-9]*$"
                                              },
                                              "denominator": {
                                                "type": "string",
                                                "pattern": "^[1-9][0-9]*$"
                                              },
                                              "evidence": {
                                                "type": "array",
                                                "minItems": 1,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string"
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          },
                                          "period": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "from",
                                              "through"
                                            ],
                                            "properties": {
                                              "from": {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              "through": {
                                                "type": "string",
                                                "format": "date-time"
                                              }
                                            }
                                          },
                                          "facts": {
                                            "type": "object",
                                            "maxProperties": 100,
                                            "additionalProperties": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "occurrenceId"
                                                  ],
                                                  "properties": {
                                                    "occurrenceId": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "claimId",
                                                    "component"
                                                  ],
                                                  "properties": {
                                                    "claimId": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "component": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "originLedgerId",
                                                        "accountCode"
                                                      ],
                                                      "properties": {
                                                        "originLedgerId": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "accountCode": {
                                                          "type": "integer"
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              ]
                                            }
                                          },
                                          "evidence": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "billing": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "service": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "acceptance": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "economic": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "payment": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "financialAccountId",
                                          "direction",
                                          "amount",
                                          "currency",
                                          "partyId",
                                          "effectiveAt",
                                          "sourceFactId",
                                          "evidence"
                                        ],
                                        "properties": {
                                          "financialAccountId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "direction": {
                                            "enum": [
                                              "in",
                                              "out"
                                            ]
                                          },
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^[1-9][0-9]*$"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "partyId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "effectiveAt": {
                                            "type": "string",
                                            "format": "date-time"
                                          },
                                          "sourceFactId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "evidence": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 20,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "kind",
                                                "ref"
                                              ],
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "tap_message",
                                                    "x402_receipt",
                                                    "chain_tx",
                                                    "signed_doc",
                                                    "stripe_object",
                                                    "other"
                                                  ]
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "signer": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            ]
                          },
                          "interpretation": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              },
                              "promptVersion": {
                                "type": "string",
                                "minLength": 1
                              },
                              "buyer": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Exact observed buyer; historical proposals without this field remain review cases."
                              },
                              "spans": {
                                "type": "array",
                                "maxItems": 1000,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "cid",
                              "promptVersion",
                              "spans"
                            ]
                          },
                          "preview": {
                            "description": "Read-only ordinary activity or priced-rights preparation, when validation succeeds."
                          }
                        },
                        "oneOf": [
                          {
                            "properties": {
                              "disposition": {
                                "const": "ready"
                              },
                              "missing": {
                                "maxItems": 0
                              },
                              "lines": {
                                "minItems": 1
                              }
                            },
                            "required": [
                              "command",
                              "contract",
                              "currency",
                              "totalMinor"
                            ]
                          },
                          {
                            "properties": {
                              "disposition": {
                                "enum": [
                                  "needs_information",
                                  "duplicate",
                                  "unsupported"
                                ]
                              }
                            },
                            "not": {
                              "required": [
                                "command"
                              ]
                            }
                          }
                        ]
                      },
                      "invoiceCorrection": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "principal": {
                            "type": "string"
                          },
                          "provenance": {
                            "const": "caller_selected_source_spans"
                          },
                          "choices": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "headers": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "vendor": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "buyer": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "externalId": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "date": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "total": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  }
                                },
                                "required": [
                                  "vendor",
                                  "buyer",
                                  "externalId",
                                  "date",
                                  "currency",
                                  "total"
                                ]
                              },
                              "service": {
                                "enum": [
                                  "delivered",
                                  "not_delivered",
                                  "unclear"
                                ]
                              },
                              "rows": {
                                "type": "array",
                                "maxItems": 64,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "role": {
                                      "enum": [
                                        "charge",
                                        "tax",
                                        "summary",
                                        "other",
                                        "unclear"
                                      ]
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^(?:none|v[0-9]{1,3})$"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "headers",
                              "service",
                              "rows"
                            ]
                          }
                        },
                        "required": [
                          "at",
                          "principal",
                          "provenance",
                          "choices"
                        ]
                      },
                      "proposalRevision": {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 8
                      },
                      "proposalHistory": {
                        "type": "array",
                        "maxItems": 7,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "principal": {
                              "type": "string"
                            },
                            "expenseTargets": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "contractId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "activityKey": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  }
                                },
                                "required": [
                                  "contractId",
                                  "activityKey"
                                ]
                              }
                            },
                            "proposal": {
                              "type": "object",
                              "additionalProperties": false,
                              "description": "Frozen source-backed expense proposal. Proposal generation creates no financial entries.",
                              "required": [
                                "disposition",
                                "source",
                                "missing",
                                "lines"
                              ],
                              "properties": {
                                "disposition": {
                                  "enum": [
                                    "ready",
                                    "needs_information",
                                    "duplicate",
                                    "unsupported"
                                  ]
                                },
                                "source": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "documentId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "documentId",
                                    "cid"
                                  ]
                                },
                                "missing": {
                                  "type": "array",
                                  "maxItems": 100,
                                  "items": {
                                    "type": "string",
                                    "maxLength": 500
                                  }
                                },
                                "lines": {
                                  "type": "array",
                                  "maxItems": 500,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "index": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "description": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^[0-9]+$"
                                      }
                                    },
                                    "required": [
                                      "index",
                                      "description",
                                      "amountMinor"
                                    ]
                                  }
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "totalMinor": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                },
                                "matchedOccurrenceId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An existing matching economic fact."
                                },
                                "contract": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "contractId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "documentId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "contractId",
                                    "documentId",
                                    "cid"
                                  ]
                                },
                                "command": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "description": "Complete ordinary public command envelope; present only when ready.",
                                      "required": [
                                        "name",
                                        "input",
                                        "source_document_id",
                                        "effective_at",
                                        "idempotency_key"
                                      ],
                                      "properties": {
                                        "name": {
                                          "const": "contracts.record"
                                        },
                                        "source_document_id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "effective_at": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date-time"
                                        },
                                        "idempotency_key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 256
                                        },
                                        "input": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "contractId",
                                            "activityKey",
                                            "occurrenceKey",
                                            "sourceFactId",
                                            "effectiveAt",
                                            "facts",
                                            "evidence"
                                          ],
                                          "properties": {
                                            "contractId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "activityKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "occurrenceKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "sourceFactId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "effectiveAt": {
                                              "type": "string",
                                              "minLength": 1,
                                              "format": "date-time"
                                            },
                                            "phase": {
                                              "const": "billing"
                                            },
                                            "obligationKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "facts": {
                                              "type": "object",
                                              "maxProperties": 100,
                                              "additionalProperties": {
                                                "type": "string"
                                              }
                                            },
                                            "evidence": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "service"
                                              ],
                                              "properties": {
                                                "billing": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 1,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "kind": {
                                                        "const": "other"
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ]
                                                  }
                                                },
                                                "service": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 1,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "kind": {
                                                        "const": "other"
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ]
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "description": "Complete ordinary public command envelope; present only when ready.",
                                      "required": [
                                        "name",
                                        "input",
                                        "source_document_id",
                                        "effective_at",
                                        "idempotency_key"
                                      ],
                                      "properties": {
                                        "name": {
                                          "const": "receipts.record"
                                        },
                                        "source_document_id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "effective_at": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date-time"
                                        },
                                        "idempotency_key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 256
                                        },
                                        "input": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "billing",
                                            "payment"
                                          ],
                                          "properties": {
                                            "processing": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "rail",
                                                "netAmount",
                                                "evidence"
                                              ],
                                              "properties": {
                                                "rail": {
                                                  "enum": [
                                                    "ach",
                                                    "ach_same_day",
                                                    "fedwire",
                                                    "rtp",
                                                    "sepa",
                                                    "sepa_instant",
                                                    "swift",
                                                    "onchain",
                                                    "internal",
                                                    "card"
                                                  ]
                                                },
                                                "netAmount": {
                                                  "type": "string",
                                                  "pattern": "^(0|-?[1-9][0-9]*)$"
                                                },
                                                "feeFacts": {
                                                  "type": "object",
                                                  "maxProperties": 20,
                                                  "additionalProperties": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]*)$"
                                                  }
                                                },
                                                "evidence": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 20,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ],
                                                    "properties": {
                                                      "kind": {
                                                        "enum": [
                                                          "tap_message",
                                                          "x402_receipt",
                                                          "chain_tx",
                                                          "signed_doc",
                                                          "stripe_object",
                                                          "other"
                                                        ]
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "signer": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "billing": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "contractId",
                                                "activityKey",
                                                "occurrenceKey",
                                                "sourceFactId",
                                                "effectiveAt",
                                                "phase"
                                              ],
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "obligationKey": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "obligationKey"
                                                  ]
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "period": {
                                                      "type": "object",
                                                      "properties": {
                                                        "from": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "through": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "from",
                                                        "through"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "period"
                                                  ]
                                                }
                                              ],
                                              "properties": {
                                                "contractId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "activityKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "occurrenceKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "obligationKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "sourceFactId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "effectiveAt": {
                                                  "type": "string",
                                                  "format": "date-time"
                                                },
                                                "phase": {
                                                  "const": "billing"
                                                },
                                                "dueDate": {
                                                  "type": "string",
                                                  "format": "date"
                                                },
                                                "exchangeRate": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "base",
                                                    "quote",
                                                    "date",
                                                    "numerator",
                                                    "denominator",
                                                    "evidence"
                                                  ],
                                                  "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                                  "properties": {
                                                    "base": {
                                                      "type": "string",
                                                      "pattern": "^[A-Z]{3}$"
                                                    },
                                                    "quote": {
                                                      "type": "string",
                                                      "pattern": "^[A-Z]{3}$"
                                                    },
                                                    "date": {
                                                      "type": "string",
                                                      "format": "date"
                                                    },
                                                    "numerator": {
                                                      "type": "string",
                                                      "pattern": "^[1-9][0-9]*$"
                                                    },
                                                    "denominator": {
                                                      "type": "string",
                                                      "pattern": "^[1-9][0-9]*$"
                                                    },
                                                    "evidence": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string"
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                },
                                                "period": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "from",
                                                    "through"
                                                  ],
                                                  "properties": {
                                                    "from": {
                                                      "type": "string",
                                                      "format": "date-time"
                                                    },
                                                    "through": {
                                                      "type": "string",
                                                      "format": "date-time"
                                                    }
                                                  }
                                                },
                                                "facts": {
                                                  "type": "object",
                                                  "maxProperties": 100,
                                                  "additionalProperties": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string"
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "occurrenceId"
                                                        ],
                                                        "properties": {
                                                          "occurrenceId": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "claimId",
                                                          "component"
                                                        ],
                                                        "properties": {
                                                          "claimId": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "component": {
                                                            "type": "object",
                                                            "additionalProperties": false,
                                                            "required": [
                                                              "originLedgerId",
                                                              "accountCode"
                                                            ],
                                                            "properties": {
                                                              "originLedgerId": {
                                                                "type": "string",
                                                                "minLength": 1
                                                              },
                                                              "accountCode": {
                                                                "type": "integer"
                                                              }
                                                            }
                                                          }
                                                        }
                                                      }
                                                    ]
                                                  }
                                                },
                                                "evidence": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "billing": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "service": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "acceptance": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "economic": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "payment": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "financialAccountId",
                                                "direction",
                                                "amount",
                                                "currency",
                                                "partyId",
                                                "effectiveAt",
                                                "sourceFactId",
                                                "evidence"
                                              ],
                                              "properties": {
                                                "financialAccountId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "direction": {
                                                  "enum": [
                                                    "in",
                                                    "out"
                                                  ]
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^[1-9][0-9]*$"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "partyId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "effectiveAt": {
                                                  "type": "string",
                                                  "format": "date-time"
                                                },
                                                "sourceFactId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "evidence": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 20,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ],
                                                    "properties": {
                                                      "kind": {
                                                        "enum": [
                                                          "tap_message",
                                                          "x402_receipt",
                                                          "chain_tx",
                                                          "signed_doc",
                                                          "stripe_object",
                                                          "other"
                                                        ]
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "signer": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  ]
                                },
                                "interpretation": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "promptVersion": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "buyer": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "Exact observed buyer; historical proposals without this field remain review cases."
                                    },
                                    "spans": {
                                      "type": "array",
                                      "maxItems": 1000,
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "start": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "end": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 65536
                                          },
                                          "text": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "start",
                                          "end",
                                          "text"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "cid",
                                    "promptVersion",
                                    "spans"
                                  ]
                                },
                                "preview": {
                                  "description": "Read-only ordinary activity or priced-rights preparation, when validation succeeds."
                                }
                              },
                              "oneOf": [
                                {
                                  "properties": {
                                    "disposition": {
                                      "const": "ready"
                                    },
                                    "missing": {
                                      "maxItems": 0
                                    },
                                    "lines": {
                                      "minItems": 1
                                    }
                                  },
                                  "required": [
                                    "command",
                                    "contract",
                                    "currency",
                                    "totalMinor"
                                  ]
                                },
                                {
                                  "properties": {
                                    "disposition": {
                                      "enum": [
                                        "needs_information",
                                        "duplicate",
                                        "unsupported"
                                      ]
                                    }
                                  },
                                  "not": {
                                    "required": [
                                      "command"
                                    ]
                                  }
                                }
                              ]
                            },
                            "invoiceCorrection": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "at": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "principal": {
                                  "type": "string"
                                },
                                "provenance": {
                                  "const": "caller_selected_source_spans"
                                },
                                "choices": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "headers": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "vendor": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "buyer": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "externalId": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "date": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "currency": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "total": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        }
                                      },
                                      "required": [
                                        "vendor",
                                        "buyer",
                                        "externalId",
                                        "date",
                                        "currency",
                                        "total"
                                      ]
                                    },
                                    "service": {
                                      "enum": [
                                        "delivered",
                                        "not_delivered",
                                        "unclear"
                                      ]
                                    },
                                    "rows": {
                                      "type": "array",
                                      "maxItems": 64,
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "role": {
                                            "enum": [
                                              "charge",
                                              "tax",
                                              "summary",
                                              "other",
                                              "unclear"
                                            ]
                                          },
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^(?:none|v[0-9]{1,3})$"
                                          }
                                        },
                                        "required": [
                                          "role",
                                          "amount"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "headers",
                                    "service",
                                    "rows"
                                  ]
                                }
                              },
                              "required": [
                                "at",
                                "principal",
                                "provenance",
                                "choices"
                              ]
                            }
                          },
                          "required": [
                            "revision",
                            "at",
                            "principal"
                          ]
                        }
                      },
                      "original": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance"
                        ]
                      },
                      "failure": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "retryable": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "reason",
                          "retryable"
                        ]
                      },
                      "lastFailure": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "retryable": {
                            "type": "boolean"
                          },
                          "attempt": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 12
                          },
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "reason",
                          "retryable",
                          "attempt",
                          "at"
                        ]
                      },
                      "relationship": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "transcription",
                              "summary",
                              "related_original"
                            ]
                          },
                          "declaredBy": {
                            "type": "string"
                          },
                          "verification": {
                            "const": "unverified"
                          }
                        },
                        "required": [
                          "type",
                          "declaredBy",
                          "verification"
                        ]
                      },
                      "uploads": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "primary": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "contentType": {
                                "enum": [
                                  "application/pdf",
                                  "text/plain",
                                  "text/markdown",
                                  "text/csv",
                                  "application/json",
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760,
                                "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "status": {
                                "enum": [
                                  "awaiting_upload",
                                  "uploaded",
                                  "expired"
                                ]
                              },
                              "documentId": {
                                "type": "string"
                              },
                              "cid": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived upload credential. Send exact bytes to this URL with the returned method and contentType; no OAuth header is required. Present only in the response of the command that issued it (ingestions.start, ingestions.attach_original, ingestions.reissue_upload); replays and reads omit it, so call ingestions.reissue_upload for a fresh one."
                              },
                              "method": {
                                "const": "PUT",
                                "description": "Present when this response issued the upload URL."
                              }
                            },
                            "required": [
                              "filename",
                              "contentType",
                              "size",
                              "expiresAt",
                              "status"
                            ]
                          },
                          "original": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "contentType": {
                                "enum": [
                                  "application/pdf",
                                  "text/plain",
                                  "text/markdown",
                                  "text/csv",
                                  "application/json",
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760,
                                "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "status": {
                                "enum": [
                                  "awaiting_upload",
                                  "uploaded",
                                  "expired"
                                ]
                              },
                              "documentId": {
                                "type": "string"
                              },
                              "cid": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived upload credential. Send exact bytes to this URL with the returned method and contentType; no OAuth header is required. Present only in the response of the command that issued it (ingestions.start, ingestions.attach_original, ingestions.reissue_upload); replays and reads omit it, so call ingestions.reissue_upload for a fresh one."
                              },
                              "method": {
                                "const": "PUT",
                                "description": "Present when this response issued the upload URL."
                              }
                            },
                            "required": [
                              "filename",
                              "contentType",
                              "size",
                              "expiresAt",
                              "status"
                            ]
                          }
                        }
                      },
                      "revisions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "startedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "business": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "legalName": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "name",
                                "legalName"
                              ]
                            },
                            "completedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "status": {
                              "enum": [
                                "processing",
                                "completed",
                                "failed"
                              ]
                            },
                            "sources": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "documentId": {
                                    "type": "string"
                                  },
                                  "cid": {
                                    "type": "string"
                                  },
                                  "format": {
                                    "enum": [
                                      "markdown",
                                      "text",
                                      "document"
                                    ]
                                  },
                                  "provenance": {
                                    "enum": [
                                      "caller_supplied_unverified",
                                      "registered_bytes"
                                    ]
                                  },
                                  "role": {
                                    "enum": [
                                      "primary",
                                      "original"
                                    ]
                                  }
                                },
                                "required": [
                                  "documentId",
                                  "cid",
                                  "format",
                                  "provenance",
                                  "role"
                                ]
                              }
                            },
                            "failure": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "reason": {
                                  "type": "string"
                                },
                                "retryable": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "reason",
                                "retryable"
                              ]
                            },
                            "invoiceSelection": {
                              "type": "object",
                              "additionalProperties": false,
                              "description": "Observed source-span choices, bound to the committed UTF-8 extraction. Spans versions pick candidate indices; fields versions carry verified UTF-8 spans for header and payment-identity values. Choice probability is not financial accuracy or authorization.",
                              "properties": {
                                "textCid": {
                                  "type": "string"
                                },
                                "promptVersion": {
                                  "enum": [
                                    "invoice-fields-v5",
                                    "receipt-fields-v5",
                                    "invoice-spans-v1",
                                    "receipt-spans-v1",
                                    "invoice-fields-v1",
                                    "receipt-fields-v1",
                                    "invoice-fields-v2",
                                    "receipt-fields-v2",
                                    "invoice-fields-v3",
                                    "receipt-fields-v3",
                                    "invoice-fields-v4",
                                    "receipt-fields-v4"
                                  ]
                                },
                                "headers": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "vendor": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "buyer": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "externalId": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "date": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "currency": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "total": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "vendor",
                                    "buyer",
                                    "externalId",
                                    "date",
                                    "currency",
                                    "total"
                                  ]
                                },
                                "provider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "The model that chose header values and optional source-line amounts: Clef for spans versions, Clairic for fields versions.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/cloudflare/clef-flash",
                                        "@cf/cloudflare/clef",
                                        "@cf/cloudflare/clairic"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "judgmentProvider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "Fields versions only: the Clef model or bounded Flash-to-Clef cascade that answered currency, service, payment status and row judgments. Optional Clairic amount reads are accounted in provider.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/cloudflare/clef-flash",
                                        "@cf/cloudflare/clef",
                                        "@cf/cloudflare/clef-flash+clef/uncertain-groups-v1"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "groupingProvider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "Measured optional grouping attempt, including a failed attempt that retains physical rows.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/moonshotai/kimi-k2.6"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "rowGroups": {
                                  "type": "array",
                                  "maxItems": 1024,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "firstRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "lastRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "anchorRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "description": {
                                        "type": "object",
                                        "properties": {
                                          "start": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 65536
                                          },
                                          "end": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 65536
                                          },
                                          "text": {
                                            "type": "string",
                                            "maxLength": 65536
                                          }
                                        },
                                        "required": [
                                          "start",
                                          "end",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "firstRow",
                                      "lastRow",
                                      "anchorRow"
                                    ]
                                  }
                                },
                                "service": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "choice": {
                                      "type": "string",
                                      "maxLength": 32
                                    },
                                    "probability": {
                                      "type": "string",
                                      "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                    },
                                    "span": {
                                      "type": "object",
                                      "properties": {
                                        "start": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 65536
                                        },
                                        "end": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 65536
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 65536
                                        }
                                      },
                                      "required": [
                                        "start",
                                        "end",
                                        "text"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "choice",
                                    "probability"
                                  ]
                                },
                                "payment": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "status": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "externalId": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "last4": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "status",
                                    "externalId",
                                    "last4"
                                  ]
                                },
                                "rows": {
                                  "type": "array",
                                  "maxItems": 1024,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "role": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "choice": {
                                            "type": "string",
                                            "maxLength": 32
                                          },
                                          "probability": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                          },
                                          "span": {
                                            "type": "object",
                                            "properties": {
                                              "start": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "end": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "text": {
                                                "type": "string",
                                                "maxLength": 65536
                                              }
                                            },
                                            "required": [
                                              "start",
                                              "end",
                                              "text"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "choice",
                                          "probability"
                                        ]
                                      },
                                      "amount": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "choice": {
                                            "type": "string",
                                            "maxLength": 32
                                          },
                                          "probability": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                          },
                                          "span": {
                                            "type": "object",
                                            "properties": {
                                              "start": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "end": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "text": {
                                                "type": "string",
                                                "maxLength": 65536
                                              }
                                            },
                                            "required": [
                                              "start",
                                              "end",
                                              "text"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "choice",
                                          "probability"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "role",
                                      "amount"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "textCid",
                                "promptVersion",
                                "headers",
                                "service",
                                "rows"
                              ]
                            },
                            "extraction": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "status": {
                                  "enum": [
                                    "not_required",
                                    "extracted",
                                    "incomplete"
                                  ]
                                },
                                "method": {
                                  "enum": [
                                    "provided_text",
                                    "native_pdf",
                                    "image_ocr",
                                    "pdf_ocr"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 65536,
                                  "description": "Returned only after source-document authorization; raw history contains annex references."
                                },
                                "textBytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 65536
                                },
                                "source": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "documentId": {
                                      "type": "string"
                                    },
                                    "cid": {
                                      "type": "string"
                                    },
                                    "format": {
                                      "enum": [
                                        "markdown",
                                        "text",
                                        "document"
                                      ]
                                    },
                                    "provenance": {
                                      "enum": [
                                        "caller_supplied_unverified",
                                        "registered_bytes"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "documentId",
                                    "cid",
                                    "format",
                                    "provenance"
                                  ]
                                },
                                "derived": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "cid": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "cid"
                                  ]
                                },
                                "pageCount": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ],
                                  "minimum": 1,
                                  "maximum": 50
                                },
                                "locations": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "page": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ],
                                        "minimum": 1
                                      },
                                      "start": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "end": {
                                        "type": "integer",
                                        "minimum": 0
                                      }
                                    },
                                    "required": [
                                      "page",
                                      "start",
                                      "end"
                                    ]
                                  }
                                },
                                "provider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "name": {
                                      "type": "string"
                                    },
                                    "version": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version"
                                  ]
                                },
                                "usage": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "conversionTokens": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "description": "Estimated native conversion tokens, distinct from inference usage."
                                    }
                                  },
                                  "required": [
                                    "inputTokens",
                                    "outputTokens",
                                    "latencyMs"
                                  ]
                                }
                              },
                              "required": [
                                "status",
                                "method",
                                "textBytes",
                                "source",
                                "derived",
                                "pageCount",
                                "locations",
                                "provider",
                                "usage"
                              ]
                            },
                            "classification": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "documentType": {
                                  "enum": [
                                    "invoice",
                                    "receipt",
                                    "agreement",
                                    "statement_or_remittance",
                                    "credit_or_correction",
                                    "reminder",
                                    "mixed",
                                    "other",
                                    "uncertain"
                                  ]
                                },
                                "probabilities": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "invoice": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "receipt": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "agreement": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "statement_or_remittance": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "credit_or_correction": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "reminder": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "mixed": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "other": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "uncertain": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    }
                                  },
                                  "required": [
                                    "invoice",
                                    "receipt",
                                    "agreement",
                                    "statement_or_remittance",
                                    "credit_or_correction",
                                    "reminder",
                                    "mixed",
                                    "other",
                                    "uncertain"
                                  ]
                                },
                                "model": {
                                  "type": "string"
                                },
                                "modelVersion": {
                                  "type": "string"
                                },
                                "promptVersion": {
                                  "type": "string"
                                },
                                "confidence": {
                                  "type": "string",
                                  "description": "Distribution confidence, not calibrated accuracy or permission to act."
                                },
                                "invoiceRole": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "role": {
                                      "enum": [
                                        "buyer",
                                        "seller",
                                        "neither",
                                        "unclear"
                                      ]
                                    },
                                    "probabilities": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "buyer": {
                                          "type": "string"
                                        },
                                        "seller": {
                                          "type": "string"
                                        },
                                        "neither": {
                                          "type": "string"
                                        },
                                        "unclear": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "buyer",
                                        "seller",
                                        "neither",
                                        "unclear"
                                      ]
                                    },
                                    "confidence": {
                                      "type": "string"
                                    },
                                    "promptVersion": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "probabilities",
                                    "confidence",
                                    "promptVersion"
                                  ]
                                },
                                "usage": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                }
                              },
                              "required": [
                                "documentType",
                                "probabilities",
                                "model",
                                "modelVersion",
                                "promptVersion"
                              ]
                            }
                          },
                          "required": [
                            "revision",
                            "startedAt",
                            "business",
                            "status",
                            "sources"
                          ]
                        }
                      }
                    },
                    "required": [
                      "ingestionId",
                      "createdAt",
                      "status",
                      "uploads",
                      "revisions"
                    ],
                    "x-relative-urls": [
                      "/uploads/primary/url",
                      "/uploads/original/url"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "disposition",
                      "source",
                      "missing"
                    ],
                    "allOf": [
                      {
                        "if": {
                          "properties": {
                            "disposition": {
                              "const": "ready"
                            }
                          }
                        },
                        "then": {
                          "required": [
                            "original",
                            "lines",
                            "totalMinor",
                            "currency",
                            "preview",
                            "command"
                          ]
                        }
                      }
                    ],
                    "properties": {
                      "disposition": {
                        "enum": [
                          "ready",
                          "needs_information"
                        ]
                      },
                      "source": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance",
                          "textCid",
                          "location"
                        ],
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          },
                          "textCid": {
                            "type": "string"
                          },
                          "location": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "start",
                              "end"
                            ],
                            "properties": {
                              "start": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "end": {
                                "type": "integer",
                                "minimum": 0
                              }
                            }
                          }
                        }
                      },
                      "missing": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "original": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "occurrenceId",
                          "documentId",
                          "cid",
                          "sourceFactId",
                          "contractId",
                          "activityKey",
                          "contractDocumentId",
                          "source"
                        ],
                        "properties": {
                          "occurrenceId": {
                            "type": "string"
                          },
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "sourceFactId": {
                            "type": "string"
                          },
                          "contractId": {
                            "type": "string"
                          },
                          "activityKey": {
                            "type": "string"
                          },
                          "contractDocumentId": {
                            "type": "string"
                          },
                          "source": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "documentId",
                              "cid"
                            ]
                          }
                        }
                      },
                      "lines": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "index": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1
                            },
                            "amountMinor": {
                              "type": "string",
                              "pattern": "^[0-9]+$"
                            }
                          },
                          "required": [
                            "index",
                            "description",
                            "amountMinor"
                          ]
                        }
                      },
                      "totalMinor": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "preview": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "occurrenceIds",
                          "repeated",
                          "postings"
                        ],
                        "properties": {
                          "occurrenceIds": {
                            "type": "array",
                            "maxItems": 1,
                            "items": {
                              "type": "string"
                            }
                          },
                          "repeated": {
                            "const": false
                          },
                          "postings": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "ledgerId",
                                "accountCode",
                                "direction",
                                "amount"
                              ],
                              "properties": {
                                "ledgerId": {
                                  "type": "string"
                                },
                                "accountCode": {
                                  "type": "integer"
                                },
                                "direction": {
                                  "enum": [
                                    "debit",
                                    "credit"
                                  ]
                                },
                                "amount": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                }
                              }
                            }
                          }
                        }
                      },
                      "command": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "input",
                          "source_document_id",
                          "effective_at",
                          "idempotency_key"
                        ],
                        "properties": {
                          "name": {
                            "const": "contracts.reverse_economics"
                          },
                          "input": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "contractId",
                              "activityKey",
                              "occurrenceId",
                              "effectiveAt",
                              "sourceFactId",
                              "evidence"
                            ],
                            "properties": {
                              "contractId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "activityKey": {
                                "type": "string",
                                "minLength": 1
                              },
                              "occurrenceId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "sourceFactId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "effectiveAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "evidence": {
                                "type": "array",
                                "minItems": 1,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "kind",
                                    "ref"
                                  ],
                                  "properties": {
                                    "kind": {
                                      "enum": [
                                        "tap_message",
                                        "x402_receipt",
                                        "chain_tx",
                                        "signed_doc",
                                        "stripe_object",
                                        "other"
                                      ]
                                    },
                                    "ref": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "signer": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  }
                                }
                              },
                              "refundSettled": {
                                "const": true
                              },
                              "recognitionOnly": {
                                "const": true
                              }
                            }
                          },
                          "source_document_id": {
                            "type": "string"
                          },
                          "effective_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "idempotency_key": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "proposalRevision": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 8
                      },
                      "textCid": {
                        "type": "string"
                      },
                      "candidates": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "headers": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "vendor": {
                                "type": "array",
                                "maxItems": 254,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "maxLength": 65536
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              },
                              "buyer": {
                                "type": "array",
                                "maxItems": 254,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "maxLength": 65536
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              },
                              "externalId": {
                                "type": "array",
                                "maxItems": 254,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "maxLength": 65536
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              },
                              "date": {
                                "type": "array",
                                "maxItems": 254,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "maxLength": 65536
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              },
                              "currency": {
                                "type": "array",
                                "maxItems": 254,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "maxLength": 65536
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              },
                              "total": {
                                "type": "array",
                                "maxItems": 254,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "maxLength": 65536
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "vendor",
                              "buyer",
                              "externalId",
                              "date",
                              "currency",
                              "total"
                            ]
                          },
                          "rows": {
                            "type": "array",
                            "maxItems": 64,
                            "items": {
                              "type": "object",
                              "properties": {
                                "start": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 65536
                                },
                                "end": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 65536
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 65536
                                },
                                "amounts": {
                                  "type": "array",
                                  "maxItems": 254,
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "start": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 65536
                                      },
                                      "end": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 65536
                                      },
                                      "text": {
                                        "type": "string",
                                        "maxLength": 65536
                                      }
                                    },
                                    "required": [
                                      "start",
                                      "end",
                                      "text"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "start",
                                "end",
                                "text",
                                "amounts"
                              ]
                            }
                          }
                        },
                        "required": [
                          "headers",
                          "rows"
                        ]
                      }
                    },
                    "required": [
                      "proposalRevision",
                      "textCid",
                      "candidates"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "disposition",
                      "source",
                      "missing"
                    ],
                    "properties": {
                      "disposition": {
                        "enum": [
                          "ready",
                          "needs_information"
                        ]
                      },
                      "missing": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "source": {
                        "type": "object",
                        "required": [
                          "documentId",
                          "cid",
                          "textCid",
                          "provenance"
                        ],
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "textCid": {
                            "type": "string"
                          },
                          "provenance": {
                            "enum": [
                              "registered_bytes",
                              "caller_supplied_unverified"
                            ]
                          }
                        }
                      },
                      "billing": {
                        "type": "object"
                      },
                      "preview": {
                        "type": "object"
                      },
                      "command": {
                        "type": "object",
                        "required": [
                          "name",
                          "source_document_id",
                          "effective_at",
                          "idempotency_key",
                          "input"
                        ],
                        "properties": {
                          "name": {
                            "const": "receipts.record"
                          },
                          "source_document_id": {
                            "type": "string"
                          },
                          "effective_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "idempotency_key": {
                            "type": "string"
                          },
                          "input": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "billing",
                              "payment"
                            ],
                            "properties": {
                              "processing": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "rail",
                                  "netAmount",
                                  "evidence"
                                ],
                                "properties": {
                                  "rail": {
                                    "enum": [
                                      "ach",
                                      "ach_same_day",
                                      "fedwire",
                                      "rtp",
                                      "sepa",
                                      "sepa_instant",
                                      "swift",
                                      "onchain",
                                      "internal",
                                      "card"
                                    ]
                                  },
                                  "netAmount": {
                                    "type": "string",
                                    "pattern": "^(0|-?[1-9][0-9]*)$"
                                  },
                                  "feeFacts": {
                                    "type": "object",
                                    "maxProperties": 20,
                                    "additionalProperties": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9][0-9]*)$"
                                    }
                                  },
                                  "evidence": {
                                    "type": "array",
                                    "minItems": 1,
                                    "maxItems": 20,
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "kind",
                                        "ref"
                                      ],
                                      "properties": {
                                        "kind": {
                                          "enum": [
                                            "tap_message",
                                            "x402_receipt",
                                            "chain_tx",
                                            "signed_doc",
                                            "stripe_object",
                                            "other"
                                          ]
                                        },
                                        "ref": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "signer": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              "billing": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "contractId",
                                  "activityKey",
                                  "occurrenceKey",
                                  "sourceFactId",
                                  "effectiveAt",
                                  "phase"
                                ],
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "obligationKey": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "obligationKey"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "period": {
                                        "type": "object",
                                        "properties": {
                                          "from": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "through": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "from",
                                          "through"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "period"
                                    ]
                                  }
                                ],
                                "properties": {
                                  "contractId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "activityKey": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "occurrenceKey": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "obligationKey": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "sourceFactId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effectiveAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "phase": {
                                    "const": "billing"
                                  },
                                  "dueDate": {
                                    "type": "string",
                                    "format": "date"
                                  },
                                  "exchangeRate": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "base",
                                      "quote",
                                      "date",
                                      "numerator",
                                      "denominator",
                                      "evidence"
                                    ],
                                    "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                    "properties": {
                                      "base": {
                                        "type": "string",
                                        "pattern": "^[A-Z]{3}$"
                                      },
                                      "quote": {
                                        "type": "string",
                                        "pattern": "^[A-Z]{3}$"
                                      },
                                      "date": {
                                        "type": "string",
                                        "format": "date"
                                      },
                                      "numerator": {
                                        "type": "string",
                                        "pattern": "^[1-9][0-9]*$"
                                      },
                                      "denominator": {
                                        "type": "string",
                                        "pattern": "^[1-9][0-9]*$"
                                      },
                                      "evidence": {
                                        "type": "array",
                                        "minItems": 1,
                                        "items": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "kind",
                                            "ref"
                                          ],
                                          "properties": {
                                            "kind": {
                                              "enum": [
                                                "tap_message",
                                                "x402_receipt",
                                                "chain_tx",
                                                "signed_doc",
                                                "stripe_object",
                                                "other"
                                              ]
                                            },
                                            "ref": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "signer": {
                                              "type": "string"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  },
                                  "period": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "from",
                                      "through"
                                    ],
                                    "properties": {
                                      "from": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "through": {
                                        "type": "string",
                                        "format": "date-time"
                                      }
                                    }
                                  },
                                  "facts": {
                                    "type": "object",
                                    "maxProperties": 100,
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "occurrenceId"
                                          ],
                                          "properties": {
                                            "occurrenceId": {
                                              "type": "string",
                                              "minLength": 1
                                            }
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "claimId",
                                            "component"
                                          ],
                                          "properties": {
                                            "claimId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "component": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "originLedgerId",
                                                "accountCode"
                                              ],
                                              "properties": {
                                                "originLedgerId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "accountCode": {
                                                  "type": "integer"
                                                }
                                              }
                                            }
                                          }
                                        }
                                      ]
                                    }
                                  },
                                  "evidence": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "billing": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 20,
                                        "items": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "kind",
                                            "ref"
                                          ],
                                          "properties": {
                                            "kind": {
                                              "enum": [
                                                "tap_message",
                                                "x402_receipt",
                                                "chain_tx",
                                                "signed_doc",
                                                "stripe_object",
                                                "other"
                                              ]
                                            },
                                            "ref": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "signer": {
                                              "type": "string",
                                              "minLength": 1
                                            }
                                          }
                                        }
                                      },
                                      "service": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 20,
                                        "items": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "kind",
                                            "ref"
                                          ],
                                          "properties": {
                                            "kind": {
                                              "enum": [
                                                "tap_message",
                                                "x402_receipt",
                                                "chain_tx",
                                                "signed_doc",
                                                "stripe_object",
                                                "other"
                                              ]
                                            },
                                            "ref": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "signer": {
                                              "type": "string",
                                              "minLength": 1
                                            }
                                          }
                                        }
                                      },
                                      "acceptance": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 20,
                                        "items": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "kind",
                                            "ref"
                                          ],
                                          "properties": {
                                            "kind": {
                                              "enum": [
                                                "tap_message",
                                                "x402_receipt",
                                                "chain_tx",
                                                "signed_doc",
                                                "stripe_object",
                                                "other"
                                              ]
                                            },
                                            "ref": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "signer": {
                                              "type": "string",
                                              "minLength": 1
                                            }
                                          }
                                        }
                                      },
                                      "economic": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 20,
                                        "items": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "kind",
                                            "ref"
                                          ],
                                          "properties": {
                                            "kind": {
                                              "enum": [
                                                "tap_message",
                                                "x402_receipt",
                                                "chain_tx",
                                                "signed_doc",
                                                "stripe_object",
                                                "other"
                                              ]
                                            },
                                            "ref": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "signer": {
                                              "type": "string",
                                              "minLength": 1
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              "payment": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "financialAccountId",
                                  "direction",
                                  "amount",
                                  "currency",
                                  "partyId",
                                  "effectiveAt",
                                  "sourceFactId",
                                  "evidence"
                                ],
                                "properties": {
                                  "financialAccountId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "direction": {
                                    "enum": [
                                      "in",
                                      "out"
                                    ]
                                  },
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^[1-9][0-9]*$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "partyId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effectiveAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "sourceFactId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "evidence": {
                                    "type": "array",
                                    "minItems": 1,
                                    "maxItems": 20,
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "kind",
                                        "ref"
                                      ],
                                      "properties": {
                                        "kind": {
                                          "enum": [
                                            "tap_message",
                                            "x402_receipt",
                                            "chain_tx",
                                            "signed_doc",
                                            "stripe_object",
                                            "other"
                                          ]
                                        },
                                        "ref": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "signer": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "ingestionId": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "status": {
                        "enum": [
                          "awaiting_upload",
                          "queued",
                          "processing",
                          "completed",
                          "failed"
                        ]
                      },
                      "source": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance"
                        ]
                      },
                      "expenseTargets": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 20,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "contractId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "activityKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": [
                            "contractId",
                            "activityKey"
                          ]
                        }
                      },
                      "mode": {
                        "enum": [
                          "propose",
                          "auto_record"
                        ]
                      },
                      "recordingPolicy": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "minimumConfidencePercent": {
                            "type": "integer",
                            "minimum": 60,
                            "maximum": 100
                          },
                          "fundingAccounts": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "financialAccountId",
                                "currency",
                                "last4",
                                "kind",
                                "glAccountCode"
                              ],
                              "properties": {
                                "financialAccountId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "last4": {
                                  "type": "string",
                                  "pattern": "^[0-9]{4}$"
                                },
                                "kind": {
                                  "enum": [
                                    "checking",
                                    "savings",
                                    "card",
                                    "wallet",
                                    "other"
                                  ]
                                },
                                "glAccountCode": {
                                  "enum": [
                                    1110,
                                    1310,
                                    1410,
                                    2190,
                                    2135
                                  ]
                                },
                                "ownerPartyId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "providerPartyId": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            }
                          },
                          "targets": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "contractId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "activityKey": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "cid": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              "required": [
                                "contractId",
                                "activityKey",
                                "cid"
                              ]
                            }
                          }
                        },
                        "required": [
                          "minimumConfidencePercent",
                          "targets"
                        ]
                      },
                      "execution": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "status": {
                            "enum": [
                              "pending",
                              "recorded",
                              "already_recorded",
                              "needs_review"
                            ]
                          },
                          "proposalRevision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8
                          },
                          "commandId": {
                            "type": "string",
                            "description": "Actual ordinary financial command receipt."
                          },
                          "occurrenceId": {
                            "type": "string",
                            "description": "An already recorded matching economic fact."
                          },
                          "reason": {
                            "type": "string",
                            "description": "Why automatic recording requires review."
                          }
                        },
                        "required": [
                          "status",
                          "proposalRevision"
                        ],
                        "description": "Durable financial recording disposition and actual ordinary command receipt reference."
                      },
                      "proposal": {
                        "type": "object",
                        "additionalProperties": false,
                        "description": "Frozen source-backed expense proposal. Proposal generation creates no financial entries.",
                        "required": [
                          "disposition",
                          "source",
                          "missing",
                          "lines"
                        ],
                        "properties": {
                          "disposition": {
                            "enum": [
                              "ready",
                              "needs_information",
                              "duplicate",
                              "unsupported"
                            ]
                          },
                          "source": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "documentId",
                              "cid"
                            ]
                          },
                          "missing": {
                            "type": "array",
                            "maxItems": 100,
                            "items": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "lines": {
                            "type": "array",
                            "maxItems": 500,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "index": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                }
                              },
                              "required": [
                                "index",
                                "description",
                                "amountMinor"
                              ]
                            }
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^[0-9]+$"
                          },
                          "matchedOccurrenceId": {
                            "type": "string",
                            "minLength": 1,
                            "description": "An existing matching economic fact."
                          },
                          "contract": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "contractId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "contractId",
                              "documentId",
                              "cid"
                            ]
                          },
                          "command": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "Complete ordinary public command envelope; present only when ready.",
                                "required": [
                                  "name",
                                  "input",
                                  "source_document_id",
                                  "effective_at",
                                  "idempotency_key"
                                ],
                                "properties": {
                                  "name": {
                                    "const": "contracts.record"
                                  },
                                  "source_document_id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effective_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date-time"
                                  },
                                  "idempotency_key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 256
                                  },
                                  "input": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "contractId",
                                      "activityKey",
                                      "occurrenceKey",
                                      "sourceFactId",
                                      "effectiveAt",
                                      "facts",
                                      "evidence"
                                    ],
                                    "properties": {
                                      "contractId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "activityKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "occurrenceKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "sourceFactId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "effectiveAt": {
                                        "type": "string",
                                        "minLength": 1,
                                        "format": "date-time"
                                      },
                                      "phase": {
                                        "const": "billing"
                                      },
                                      "obligationKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "facts": {
                                        "type": "object",
                                        "maxProperties": 100,
                                        "additionalProperties": {
                                          "type": "string"
                                        }
                                      },
                                      "evidence": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "service"
                                        ],
                                        "properties": {
                                          "billing": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 1,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "const": "other"
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "ref"
                                              ]
                                            }
                                          },
                                          "service": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 1,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "const": "other"
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "ref"
                                              ]
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "Complete ordinary public command envelope; present only when ready.",
                                "required": [
                                  "name",
                                  "input",
                                  "source_document_id",
                                  "effective_at",
                                  "idempotency_key"
                                ],
                                "properties": {
                                  "name": {
                                    "const": "receipts.record"
                                  },
                                  "source_document_id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effective_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date-time"
                                  },
                                  "idempotency_key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 256
                                  },
                                  "input": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "billing",
                                      "payment"
                                    ],
                                    "properties": {
                                      "processing": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "rail",
                                          "netAmount",
                                          "evidence"
                                        ],
                                        "properties": {
                                          "rail": {
                                            "enum": [
                                              "ach",
                                              "ach_same_day",
                                              "fedwire",
                                              "rtp",
                                              "sepa",
                                              "sepa_instant",
                                              "swift",
                                              "onchain",
                                              "internal",
                                              "card"
                                            ]
                                          },
                                          "netAmount": {
                                            "type": "string",
                                            "pattern": "^(0|-?[1-9][0-9]*)$"
                                          },
                                          "feeFacts": {
                                            "type": "object",
                                            "maxProperties": 20,
                                            "additionalProperties": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]*)$"
                                            }
                                          },
                                          "evidence": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 20,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "kind",
                                                "ref"
                                              ],
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "tap_message",
                                                    "x402_receipt",
                                                    "chain_tx",
                                                    "signed_doc",
                                                    "stripe_object",
                                                    "other"
                                                  ]
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "signer": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "billing": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "contractId",
                                          "activityKey",
                                          "occurrenceKey",
                                          "sourceFactId",
                                          "effectiveAt",
                                          "phase"
                                        ],
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "obligationKey": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "obligationKey"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "period": {
                                                "type": "object",
                                                "properties": {
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "through": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "from",
                                                  "through"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "period"
                                            ]
                                          }
                                        ],
                                        "properties": {
                                          "contractId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "activityKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "occurrenceKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "obligationKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "sourceFactId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "effectiveAt": {
                                            "type": "string",
                                            "format": "date-time"
                                          },
                                          "phase": {
                                            "const": "billing"
                                          },
                                          "dueDate": {
                                            "type": "string",
                                            "format": "date"
                                          },
                                          "exchangeRate": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "base",
                                              "quote",
                                              "date",
                                              "numerator",
                                              "denominator",
                                              "evidence"
                                            ],
                                            "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                            "properties": {
                                              "base": {
                                                "type": "string",
                                                "pattern": "^[A-Z]{3}$"
                                              },
                                              "quote": {
                                                "type": "string",
                                                "pattern": "^[A-Z]{3}$"
                                              },
                                              "date": {
                                                "type": "string",
                                                "format": "date"
                                              },
                                              "numerator": {
                                                "type": "string",
                                                "pattern": "^[1-9][0-9]*$"
                                              },
                                              "denominator": {
                                                "type": "string",
                                                "pattern": "^[1-9][0-9]*$"
                                              },
                                              "evidence": {
                                                "type": "array",
                                                "minItems": 1,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string"
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          },
                                          "period": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "from",
                                              "through"
                                            ],
                                            "properties": {
                                              "from": {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              "through": {
                                                "type": "string",
                                                "format": "date-time"
                                              }
                                            }
                                          },
                                          "facts": {
                                            "type": "object",
                                            "maxProperties": 100,
                                            "additionalProperties": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "occurrenceId"
                                                  ],
                                                  "properties": {
                                                    "occurrenceId": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "claimId",
                                                    "component"
                                                  ],
                                                  "properties": {
                                                    "claimId": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "component": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "originLedgerId",
                                                        "accountCode"
                                                      ],
                                                      "properties": {
                                                        "originLedgerId": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "accountCode": {
                                                          "type": "integer"
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              ]
                                            }
                                          },
                                          "evidence": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "billing": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "service": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "acceptance": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "economic": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "payment": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "financialAccountId",
                                          "direction",
                                          "amount",
                                          "currency",
                                          "partyId",
                                          "effectiveAt",
                                          "sourceFactId",
                                          "evidence"
                                        ],
                                        "properties": {
                                          "financialAccountId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "direction": {
                                            "enum": [
                                              "in",
                                              "out"
                                            ]
                                          },
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^[1-9][0-9]*$"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "partyId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "effectiveAt": {
                                            "type": "string",
                                            "format": "date-time"
                                          },
                                          "sourceFactId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "evidence": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 20,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "kind",
                                                "ref"
                                              ],
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "tap_message",
                                                    "x402_receipt",
                                                    "chain_tx",
                                                    "signed_doc",
                                                    "stripe_object",
                                                    "other"
                                                  ]
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "signer": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            ]
                          },
                          "interpretation": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              },
                              "promptVersion": {
                                "type": "string",
                                "minLength": 1
                              },
                              "buyer": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Exact observed buyer; historical proposals without this field remain review cases."
                              },
                              "spans": {
                                "type": "array",
                                "maxItems": 1000,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "cid",
                              "promptVersion",
                              "spans"
                            ]
                          },
                          "preview": {
                            "description": "Read-only ordinary activity or priced-rights preparation, when validation succeeds."
                          }
                        },
                        "oneOf": [
                          {
                            "properties": {
                              "disposition": {
                                "const": "ready"
                              },
                              "missing": {
                                "maxItems": 0
                              },
                              "lines": {
                                "minItems": 1
                              }
                            },
                            "required": [
                              "command",
                              "contract",
                              "currency",
                              "totalMinor"
                            ]
                          },
                          {
                            "properties": {
                              "disposition": {
                                "enum": [
                                  "needs_information",
                                  "duplicate",
                                  "unsupported"
                                ]
                              }
                            },
                            "not": {
                              "required": [
                                "command"
                              ]
                            }
                          }
                        ]
                      },
                      "invoiceCorrection": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "principal": {
                            "type": "string"
                          },
                          "provenance": {
                            "const": "caller_selected_source_spans"
                          },
                          "choices": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "headers": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "vendor": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "buyer": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "externalId": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "date": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "total": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  }
                                },
                                "required": [
                                  "vendor",
                                  "buyer",
                                  "externalId",
                                  "date",
                                  "currency",
                                  "total"
                                ]
                              },
                              "service": {
                                "enum": [
                                  "delivered",
                                  "not_delivered",
                                  "unclear"
                                ]
                              },
                              "rows": {
                                "type": "array",
                                "maxItems": 64,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "role": {
                                      "enum": [
                                        "charge",
                                        "tax",
                                        "summary",
                                        "other",
                                        "unclear"
                                      ]
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^(?:none|v[0-9]{1,3})$"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "headers",
                              "service",
                              "rows"
                            ]
                          }
                        },
                        "required": [
                          "at",
                          "principal",
                          "provenance",
                          "choices"
                        ]
                      },
                      "proposalRevision": {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 8
                      },
                      "proposalHistory": {
                        "type": "array",
                        "maxItems": 7,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "principal": {
                              "type": "string"
                            },
                            "expenseTargets": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "contractId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "activityKey": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  }
                                },
                                "required": [
                                  "contractId",
                                  "activityKey"
                                ]
                              }
                            },
                            "proposal": {
                              "type": "object",
                              "additionalProperties": false,
                              "description": "Frozen source-backed expense proposal. Proposal generation creates no financial entries.",
                              "required": [
                                "disposition",
                                "source",
                                "missing",
                                "lines"
                              ],
                              "properties": {
                                "disposition": {
                                  "enum": [
                                    "ready",
                                    "needs_information",
                                    "duplicate",
                                    "unsupported"
                                  ]
                                },
                                "source": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "documentId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "documentId",
                                    "cid"
                                  ]
                                },
                                "missing": {
                                  "type": "array",
                                  "maxItems": 100,
                                  "items": {
                                    "type": "string",
                                    "maxLength": 500
                                  }
                                },
                                "lines": {
                                  "type": "array",
                                  "maxItems": 500,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "index": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "description": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^[0-9]+$"
                                      }
                                    },
                                    "required": [
                                      "index",
                                      "description",
                                      "amountMinor"
                                    ]
                                  }
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "totalMinor": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                },
                                "matchedOccurrenceId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An existing matching economic fact."
                                },
                                "contract": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "contractId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "documentId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "contractId",
                                    "documentId",
                                    "cid"
                                  ]
                                },
                                "command": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "description": "Complete ordinary public command envelope; present only when ready.",
                                      "required": [
                                        "name",
                                        "input",
                                        "source_document_id",
                                        "effective_at",
                                        "idempotency_key"
                                      ],
                                      "properties": {
                                        "name": {
                                          "const": "contracts.record"
                                        },
                                        "source_document_id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "effective_at": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date-time"
                                        },
                                        "idempotency_key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 256
                                        },
                                        "input": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "contractId",
                                            "activityKey",
                                            "occurrenceKey",
                                            "sourceFactId",
                                            "effectiveAt",
                                            "facts",
                                            "evidence"
                                          ],
                                          "properties": {
                                            "contractId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "activityKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "occurrenceKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "sourceFactId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "effectiveAt": {
                                              "type": "string",
                                              "minLength": 1,
                                              "format": "date-time"
                                            },
                                            "phase": {
                                              "const": "billing"
                                            },
                                            "obligationKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "facts": {
                                              "type": "object",
                                              "maxProperties": 100,
                                              "additionalProperties": {
                                                "type": "string"
                                              }
                                            },
                                            "evidence": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "service"
                                              ],
                                              "properties": {
                                                "billing": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 1,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "kind": {
                                                        "const": "other"
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ]
                                                  }
                                                },
                                                "service": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 1,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "kind": {
                                                        "const": "other"
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ]
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "description": "Complete ordinary public command envelope; present only when ready.",
                                      "required": [
                                        "name",
                                        "input",
                                        "source_document_id",
                                        "effective_at",
                                        "idempotency_key"
                                      ],
                                      "properties": {
                                        "name": {
                                          "const": "receipts.record"
                                        },
                                        "source_document_id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "effective_at": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date-time"
                                        },
                                        "idempotency_key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 256
                                        },
                                        "input": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "billing",
                                            "payment"
                                          ],
                                          "properties": {
                                            "processing": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "rail",
                                                "netAmount",
                                                "evidence"
                                              ],
                                              "properties": {
                                                "rail": {
                                                  "enum": [
                                                    "ach",
                                                    "ach_same_day",
                                                    "fedwire",
                                                    "rtp",
                                                    "sepa",
                                                    "sepa_instant",
                                                    "swift",
                                                    "onchain",
                                                    "internal",
                                                    "card"
                                                  ]
                                                },
                                                "netAmount": {
                                                  "type": "string",
                                                  "pattern": "^(0|-?[1-9][0-9]*)$"
                                                },
                                                "feeFacts": {
                                                  "type": "object",
                                                  "maxProperties": 20,
                                                  "additionalProperties": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]*)$"
                                                  }
                                                },
                                                "evidence": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 20,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ],
                                                    "properties": {
                                                      "kind": {
                                                        "enum": [
                                                          "tap_message",
                                                          "x402_receipt",
                                                          "chain_tx",
                                                          "signed_doc",
                                                          "stripe_object",
                                                          "other"
                                                        ]
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "signer": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "billing": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "contractId",
                                                "activityKey",
                                                "occurrenceKey",
                                                "sourceFactId",
                                                "effectiveAt",
                                                "phase"
                                              ],
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "obligationKey": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "obligationKey"
                                                  ]
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "period": {
                                                      "type": "object",
                                                      "properties": {
                                                        "from": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "through": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "from",
                                                        "through"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "period"
                                                  ]
                                                }
                                              ],
                                              "properties": {
                                                "contractId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "activityKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "occurrenceKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "obligationKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "sourceFactId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "effectiveAt": {
                                                  "type": "string",
                                                  "format": "date-time"
                                                },
                                                "phase": {
                                                  "const": "billing"
                                                },
                                                "dueDate": {
                                                  "type": "string",
                                                  "format": "date"
                                                },
                                                "exchangeRate": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "base",
                                                    "quote",
                                                    "date",
                                                    "numerator",
                                                    "denominator",
                                                    "evidence"
                                                  ],
                                                  "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                                  "properties": {
                                                    "base": {
                                                      "type": "string",
                                                      "pattern": "^[A-Z]{3}$"
                                                    },
                                                    "quote": {
                                                      "type": "string",
                                                      "pattern": "^[A-Z]{3}$"
                                                    },
                                                    "date": {
                                                      "type": "string",
                                                      "format": "date"
                                                    },
                                                    "numerator": {
                                                      "type": "string",
                                                      "pattern": "^[1-9][0-9]*$"
                                                    },
                                                    "denominator": {
                                                      "type": "string",
                                                      "pattern": "^[1-9][0-9]*$"
                                                    },
                                                    "evidence": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string"
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                },
                                                "period": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "from",
                                                    "through"
                                                  ],
                                                  "properties": {
                                                    "from": {
                                                      "type": "string",
                                                      "format": "date-time"
                                                    },
                                                    "through": {
                                                      "type": "string",
                                                      "format": "date-time"
                                                    }
                                                  }
                                                },
                                                "facts": {
                                                  "type": "object",
                                                  "maxProperties": 100,
                                                  "additionalProperties": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string"
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "occurrenceId"
                                                        ],
                                                        "properties": {
                                                          "occurrenceId": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "claimId",
                                                          "component"
                                                        ],
                                                        "properties": {
                                                          "claimId": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "component": {
                                                            "type": "object",
                                                            "additionalProperties": false,
                                                            "required": [
                                                              "originLedgerId",
                                                              "accountCode"
                                                            ],
                                                            "properties": {
                                                              "originLedgerId": {
                                                                "type": "string",
                                                                "minLength": 1
                                                              },
                                                              "accountCode": {
                                                                "type": "integer"
                                                              }
                                                            }
                                                          }
                                                        }
                                                      }
                                                    ]
                                                  }
                                                },
                                                "evidence": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "billing": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "service": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "acceptance": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "economic": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "payment": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "financialAccountId",
                                                "direction",
                                                "amount",
                                                "currency",
                                                "partyId",
                                                "effectiveAt",
                                                "sourceFactId",
                                                "evidence"
                                              ],
                                              "properties": {
                                                "financialAccountId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "direction": {
                                                  "enum": [
                                                    "in",
                                                    "out"
                                                  ]
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^[1-9][0-9]*$"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "partyId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "effectiveAt": {
                                                  "type": "string",
                                                  "format": "date-time"
                                                },
                                                "sourceFactId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "evidence": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 20,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ],
                                                    "properties": {
                                                      "kind": {
                                                        "enum": [
                                                          "tap_message",
                                                          "x402_receipt",
                                                          "chain_tx",
                                                          "signed_doc",
                                                          "stripe_object",
                                                          "other"
                                                        ]
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "signer": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  ]
                                },
                                "interpretation": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "promptVersion": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "buyer": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "Exact observed buyer; historical proposals without this field remain review cases."
                                    },
                                    "spans": {
                                      "type": "array",
                                      "maxItems": 1000,
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "start": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "end": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 65536
                                          },
                                          "text": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "start",
                                          "end",
                                          "text"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "cid",
                                    "promptVersion",
                                    "spans"
                                  ]
                                },
                                "preview": {
                                  "description": "Read-only ordinary activity or priced-rights preparation, when validation succeeds."
                                }
                              },
                              "oneOf": [
                                {
                                  "properties": {
                                    "disposition": {
                                      "const": "ready"
                                    },
                                    "missing": {
                                      "maxItems": 0
                                    },
                                    "lines": {
                                      "minItems": 1
                                    }
                                  },
                                  "required": [
                                    "command",
                                    "contract",
                                    "currency",
                                    "totalMinor"
                                  ]
                                },
                                {
                                  "properties": {
                                    "disposition": {
                                      "enum": [
                                        "needs_information",
                                        "duplicate",
                                        "unsupported"
                                      ]
                                    }
                                  },
                                  "not": {
                                    "required": [
                                      "command"
                                    ]
                                  }
                                }
                              ]
                            },
                            "invoiceCorrection": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "at": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "principal": {
                                  "type": "string"
                                },
                                "provenance": {
                                  "const": "caller_selected_source_spans"
                                },
                                "choices": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "headers": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "vendor": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "buyer": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "externalId": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "date": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "currency": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "total": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        }
                                      },
                                      "required": [
                                        "vendor",
                                        "buyer",
                                        "externalId",
                                        "date",
                                        "currency",
                                        "total"
                                      ]
                                    },
                                    "service": {
                                      "enum": [
                                        "delivered",
                                        "not_delivered",
                                        "unclear"
                                      ]
                                    },
                                    "rows": {
                                      "type": "array",
                                      "maxItems": 64,
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "role": {
                                            "enum": [
                                              "charge",
                                              "tax",
                                              "summary",
                                              "other",
                                              "unclear"
                                            ]
                                          },
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^(?:none|v[0-9]{1,3})$"
                                          }
                                        },
                                        "required": [
                                          "role",
                                          "amount"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "headers",
                                    "service",
                                    "rows"
                                  ]
                                }
                              },
                              "required": [
                                "at",
                                "principal",
                                "provenance",
                                "choices"
                              ]
                            }
                          },
                          "required": [
                            "revision",
                            "at",
                            "principal"
                          ]
                        }
                      },
                      "original": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance"
                        ]
                      },
                      "failure": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "retryable": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "reason",
                          "retryable"
                        ]
                      },
                      "lastFailure": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "retryable": {
                            "type": "boolean"
                          },
                          "attempt": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 12
                          },
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "reason",
                          "retryable",
                          "attempt",
                          "at"
                        ]
                      },
                      "relationship": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "transcription",
                              "summary",
                              "related_original"
                            ]
                          },
                          "declaredBy": {
                            "type": "string"
                          },
                          "verification": {
                            "const": "unverified"
                          }
                        },
                        "required": [
                          "type",
                          "declaredBy",
                          "verification"
                        ]
                      },
                      "uploads": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "primary": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "contentType": {
                                "enum": [
                                  "application/pdf",
                                  "text/plain",
                                  "text/markdown",
                                  "text/csv",
                                  "application/json",
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760,
                                "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "status": {
                                "enum": [
                                  "awaiting_upload",
                                  "uploaded",
                                  "expired"
                                ]
                              },
                              "documentId": {
                                "type": "string"
                              },
                              "cid": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived upload credential. Send exact bytes to this URL with the returned method and contentType; no OAuth header is required. Present only in the response of the command that issued it (ingestions.start, ingestions.attach_original, ingestions.reissue_upload); replays and reads omit it, so call ingestions.reissue_upload for a fresh one."
                              },
                              "method": {
                                "const": "PUT",
                                "description": "Present when this response issued the upload URL."
                              }
                            },
                            "required": [
                              "filename",
                              "contentType",
                              "size",
                              "expiresAt",
                              "status"
                            ]
                          },
                          "original": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "contentType": {
                                "enum": [
                                  "application/pdf",
                                  "text/plain",
                                  "text/markdown",
                                  "text/csv",
                                  "application/json",
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760,
                                "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "status": {
                                "enum": [
                                  "awaiting_upload",
                                  "uploaded",
                                  "expired"
                                ]
                              },
                              "documentId": {
                                "type": "string"
                              },
                              "cid": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived upload credential. Send exact bytes to this URL with the returned method and contentType; no OAuth header is required. Present only in the response of the command that issued it (ingestions.start, ingestions.attach_original, ingestions.reissue_upload); replays and reads omit it, so call ingestions.reissue_upload for a fresh one."
                              },
                              "method": {
                                "const": "PUT",
                                "description": "Present when this response issued the upload URL."
                              }
                            },
                            "required": [
                              "filename",
                              "contentType",
                              "size",
                              "expiresAt",
                              "status"
                            ]
                          }
                        }
                      },
                      "revisions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "startedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "business": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "legalName": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "name",
                                "legalName"
                              ]
                            },
                            "completedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "status": {
                              "enum": [
                                "processing",
                                "completed",
                                "failed"
                              ]
                            },
                            "sources": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "documentId": {
                                    "type": "string"
                                  },
                                  "cid": {
                                    "type": "string"
                                  },
                                  "format": {
                                    "enum": [
                                      "markdown",
                                      "text",
                                      "document"
                                    ]
                                  },
                                  "provenance": {
                                    "enum": [
                                      "caller_supplied_unverified",
                                      "registered_bytes"
                                    ]
                                  },
                                  "role": {
                                    "enum": [
                                      "primary",
                                      "original"
                                    ]
                                  }
                                },
                                "required": [
                                  "documentId",
                                  "cid",
                                  "format",
                                  "provenance",
                                  "role"
                                ]
                              }
                            },
                            "failure": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "reason": {
                                  "type": "string"
                                },
                                "retryable": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "reason",
                                "retryable"
                              ]
                            },
                            "invoiceSelection": {
                              "type": "object",
                              "additionalProperties": false,
                              "description": "Observed source-span choices, bound to the committed UTF-8 extraction. Spans versions pick candidate indices; fields versions carry verified UTF-8 spans for header and payment-identity values. Choice probability is not financial accuracy or authorization.",
                              "properties": {
                                "textCid": {
                                  "type": "string"
                                },
                                "promptVersion": {
                                  "enum": [
                                    "invoice-fields-v5",
                                    "receipt-fields-v5",
                                    "invoice-spans-v1",
                                    "receipt-spans-v1",
                                    "invoice-fields-v1",
                                    "receipt-fields-v1",
                                    "invoice-fields-v2",
                                    "receipt-fields-v2",
                                    "invoice-fields-v3",
                                    "receipt-fields-v3",
                                    "invoice-fields-v4",
                                    "receipt-fields-v4"
                                  ]
                                },
                                "headers": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "vendor": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "buyer": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "externalId": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "date": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "currency": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "total": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "vendor",
                                    "buyer",
                                    "externalId",
                                    "date",
                                    "currency",
                                    "total"
                                  ]
                                },
                                "provider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "The model that chose header values and optional source-line amounts: Clef for spans versions, Clairic for fields versions.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/cloudflare/clef-flash",
                                        "@cf/cloudflare/clef",
                                        "@cf/cloudflare/clairic"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "judgmentProvider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "Fields versions only: the Clef model or bounded Flash-to-Clef cascade that answered currency, service, payment status and row judgments. Optional Clairic amount reads are accounted in provider.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/cloudflare/clef-flash",
                                        "@cf/cloudflare/clef",
                                        "@cf/cloudflare/clef-flash+clef/uncertain-groups-v1"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "groupingProvider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "Measured optional grouping attempt, including a failed attempt that retains physical rows.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/moonshotai/kimi-k2.6"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "rowGroups": {
                                  "type": "array",
                                  "maxItems": 1024,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "firstRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "lastRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "anchorRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "description": {
                                        "type": "object",
                                        "properties": {
                                          "start": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 65536
                                          },
                                          "end": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 65536
                                          },
                                          "text": {
                                            "type": "string",
                                            "maxLength": 65536
                                          }
                                        },
                                        "required": [
                                          "start",
                                          "end",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "firstRow",
                                      "lastRow",
                                      "anchorRow"
                                    ]
                                  }
                                },
                                "service": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "choice": {
                                      "type": "string",
                                      "maxLength": 32
                                    },
                                    "probability": {
                                      "type": "string",
                                      "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                    },
                                    "span": {
                                      "type": "object",
                                      "properties": {
                                        "start": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 65536
                                        },
                                        "end": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 65536
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 65536
                                        }
                                      },
                                      "required": [
                                        "start",
                                        "end",
                                        "text"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "choice",
                                    "probability"
                                  ]
                                },
                                "payment": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "status": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "externalId": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "last4": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "status",
                                    "externalId",
                                    "last4"
                                  ]
                                },
                                "rows": {
                                  "type": "array",
                                  "maxItems": 1024,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "role": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "choice": {
                                            "type": "string",
                                            "maxLength": 32
                                          },
                                          "probability": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                          },
                                          "span": {
                                            "type": "object",
                                            "properties": {
                                              "start": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "end": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "text": {
                                                "type": "string",
                                                "maxLength": 65536
                                              }
                                            },
                                            "required": [
                                              "start",
                                              "end",
                                              "text"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "choice",
                                          "probability"
                                        ]
                                      },
                                      "amount": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "choice": {
                                            "type": "string",
                                            "maxLength": 32
                                          },
                                          "probability": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                          },
                                          "span": {
                                            "type": "object",
                                            "properties": {
                                              "start": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "end": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "text": {
                                                "type": "string",
                                                "maxLength": 65536
                                              }
                                            },
                                            "required": [
                                              "start",
                                              "end",
                                              "text"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "choice",
                                          "probability"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "role",
                                      "amount"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "textCid",
                                "promptVersion",
                                "headers",
                                "service",
                                "rows"
                              ]
                            },
                            "extraction": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "status": {
                                  "enum": [
                                    "not_required",
                                    "extracted",
                                    "incomplete"
                                  ]
                                },
                                "method": {
                                  "enum": [
                                    "provided_text",
                                    "native_pdf",
                                    "image_ocr",
                                    "pdf_ocr"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 65536,
                                  "description": "Returned only after source-document authorization; raw history contains annex references."
                                },
                                "textBytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 65536
                                },
                                "source": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "documentId": {
                                      "type": "string"
                                    },
                                    "cid": {
                                      "type": "string"
                                    },
                                    "format": {
                                      "enum": [
                                        "markdown",
                                        "text",
                                        "document"
                                      ]
                                    },
                                    "provenance": {
                                      "enum": [
                                        "caller_supplied_unverified",
                                        "registered_bytes"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "documentId",
                                    "cid",
                                    "format",
                                    "provenance"
                                  ]
                                },
                                "derived": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "cid": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "cid"
                                  ]
                                },
                                "pageCount": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ],
                                  "minimum": 1,
                                  "maximum": 50
                                },
                                "locations": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "page": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ],
                                        "minimum": 1
                                      },
                                      "start": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "end": {
                                        "type": "integer",
                                        "minimum": 0
                                      }
                                    },
                                    "required": [
                                      "page",
                                      "start",
                                      "end"
                                    ]
                                  }
                                },
                                "provider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "name": {
                                      "type": "string"
                                    },
                                    "version": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version"
                                  ]
                                },
                                "usage": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "conversionTokens": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "description": "Estimated native conversion tokens, distinct from inference usage."
                                    }
                                  },
                                  "required": [
                                    "inputTokens",
                                    "outputTokens",
                                    "latencyMs"
                                  ]
                                }
                              },
                              "required": [
                                "status",
                                "method",
                                "textBytes",
                                "source",
                                "derived",
                                "pageCount",
                                "locations",
                                "provider",
                                "usage"
                              ]
                            },
                            "classification": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "documentType": {
                                  "enum": [
                                    "invoice",
                                    "receipt",
                                    "agreement",
                                    "statement_or_remittance",
                                    "credit_or_correction",
                                    "reminder",
                                    "mixed",
                                    "other",
                                    "uncertain"
                                  ]
                                },
                                "probabilities": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "invoice": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "receipt": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "agreement": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "statement_or_remittance": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "credit_or_correction": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "reminder": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "mixed": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "other": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "uncertain": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    }
                                  },
                                  "required": [
                                    "invoice",
                                    "receipt",
                                    "agreement",
                                    "statement_or_remittance",
                                    "credit_or_correction",
                                    "reminder",
                                    "mixed",
                                    "other",
                                    "uncertain"
                                  ]
                                },
                                "model": {
                                  "type": "string"
                                },
                                "modelVersion": {
                                  "type": "string"
                                },
                                "promptVersion": {
                                  "type": "string"
                                },
                                "confidence": {
                                  "type": "string",
                                  "description": "Distribution confidence, not calibrated accuracy or permission to act."
                                },
                                "invoiceRole": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "role": {
                                      "enum": [
                                        "buyer",
                                        "seller",
                                        "neither",
                                        "unclear"
                                      ]
                                    },
                                    "probabilities": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "buyer": {
                                          "type": "string"
                                        },
                                        "seller": {
                                          "type": "string"
                                        },
                                        "neither": {
                                          "type": "string"
                                        },
                                        "unclear": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "buyer",
                                        "seller",
                                        "neither",
                                        "unclear"
                                      ]
                                    },
                                    "confidence": {
                                      "type": "string"
                                    },
                                    "promptVersion": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "probabilities",
                                    "confidence",
                                    "promptVersion"
                                  ]
                                },
                                "usage": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                }
                              },
                              "required": [
                                "documentType",
                                "probabilities",
                                "model",
                                "modelVersion",
                                "promptVersion"
                              ]
                            }
                          },
                          "required": [
                            "revision",
                            "startedAt",
                            "business",
                            "status",
                            "sources"
                          ]
                        }
                      }
                    },
                    "required": [
                      "ingestionId",
                      "createdAt",
                      "status",
                      "uploads",
                      "revisions"
                    ],
                    "x-relative-urls": [
                      "/uploads/primary/url",
                      "/uploads/original/url"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "ingestionId": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "status": {
                        "enum": [
                          "awaiting_upload",
                          "queued",
                          "processing",
                          "completed",
                          "failed"
                        ]
                      },
                      "source": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance"
                        ]
                      },
                      "expenseTargets": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 20,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "contractId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "activityKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": [
                            "contractId",
                            "activityKey"
                          ]
                        }
                      },
                      "mode": {
                        "enum": [
                          "propose",
                          "auto_record"
                        ]
                      },
                      "recordingPolicy": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "minimumConfidencePercent": {
                            "type": "integer",
                            "minimum": 60,
                            "maximum": 100
                          },
                          "fundingAccounts": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "financialAccountId",
                                "currency",
                                "last4",
                                "kind",
                                "glAccountCode"
                              ],
                              "properties": {
                                "financialAccountId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "last4": {
                                  "type": "string",
                                  "pattern": "^[0-9]{4}$"
                                },
                                "kind": {
                                  "enum": [
                                    "checking",
                                    "savings",
                                    "card",
                                    "wallet",
                                    "other"
                                  ]
                                },
                                "glAccountCode": {
                                  "enum": [
                                    1110,
                                    1310,
                                    1410,
                                    2190,
                                    2135
                                  ]
                                },
                                "ownerPartyId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "providerPartyId": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            }
                          },
                          "targets": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "contractId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "activityKey": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "cid": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              "required": [
                                "contractId",
                                "activityKey",
                                "cid"
                              ]
                            }
                          }
                        },
                        "required": [
                          "minimumConfidencePercent",
                          "targets"
                        ]
                      },
                      "execution": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "status": {
                            "enum": [
                              "pending",
                              "recorded",
                              "already_recorded",
                              "needs_review"
                            ]
                          },
                          "proposalRevision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8
                          },
                          "commandId": {
                            "type": "string",
                            "description": "Actual ordinary financial command receipt."
                          },
                          "occurrenceId": {
                            "type": "string",
                            "description": "An already recorded matching economic fact."
                          },
                          "reason": {
                            "type": "string",
                            "description": "Why automatic recording requires review."
                          }
                        },
                        "required": [
                          "status",
                          "proposalRevision"
                        ],
                        "description": "Durable financial recording disposition and actual ordinary command receipt reference."
                      },
                      "proposal": {
                        "type": "object",
                        "additionalProperties": false,
                        "description": "Frozen source-backed expense proposal. Proposal generation creates no financial entries.",
                        "required": [
                          "disposition",
                          "source",
                          "missing",
                          "lines"
                        ],
                        "properties": {
                          "disposition": {
                            "enum": [
                              "ready",
                              "needs_information",
                              "duplicate",
                              "unsupported"
                            ]
                          },
                          "source": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "documentId",
                              "cid"
                            ]
                          },
                          "missing": {
                            "type": "array",
                            "maxItems": 100,
                            "items": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "lines": {
                            "type": "array",
                            "maxItems": 500,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "index": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                }
                              },
                              "required": [
                                "index",
                                "description",
                                "amountMinor"
                              ]
                            }
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^[0-9]+$"
                          },
                          "matchedOccurrenceId": {
                            "type": "string",
                            "minLength": 1,
                            "description": "An existing matching economic fact."
                          },
                          "contract": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "contractId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "contractId",
                              "documentId",
                              "cid"
                            ]
                          },
                          "command": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "Complete ordinary public command envelope; present only when ready.",
                                "required": [
                                  "name",
                                  "input",
                                  "source_document_id",
                                  "effective_at",
                                  "idempotency_key"
                                ],
                                "properties": {
                                  "name": {
                                    "const": "contracts.record"
                                  },
                                  "source_document_id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effective_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date-time"
                                  },
                                  "idempotency_key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 256
                                  },
                                  "input": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "contractId",
                                      "activityKey",
                                      "occurrenceKey",
                                      "sourceFactId",
                                      "effectiveAt",
                                      "facts",
                                      "evidence"
                                    ],
                                    "properties": {
                                      "contractId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "activityKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "occurrenceKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "sourceFactId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "effectiveAt": {
                                        "type": "string",
                                        "minLength": 1,
                                        "format": "date-time"
                                      },
                                      "phase": {
                                        "const": "billing"
                                      },
                                      "obligationKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "facts": {
                                        "type": "object",
                                        "maxProperties": 100,
                                        "additionalProperties": {
                                          "type": "string"
                                        }
                                      },
                                      "evidence": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "service"
                                        ],
                                        "properties": {
                                          "billing": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 1,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "const": "other"
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "ref"
                                              ]
                                            }
                                          },
                                          "service": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 1,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "const": "other"
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "ref"
                                              ]
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "Complete ordinary public command envelope; present only when ready.",
                                "required": [
                                  "name",
                                  "input",
                                  "source_document_id",
                                  "effective_at",
                                  "idempotency_key"
                                ],
                                "properties": {
                                  "name": {
                                    "const": "receipts.record"
                                  },
                                  "source_document_id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effective_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date-time"
                                  },
                                  "idempotency_key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 256
                                  },
                                  "input": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "billing",
                                      "payment"
                                    ],
                                    "properties": {
                                      "processing": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "rail",
                                          "netAmount",
                                          "evidence"
                                        ],
                                        "properties": {
                                          "rail": {
                                            "enum": [
                                              "ach",
                                              "ach_same_day",
                                              "fedwire",
                                              "rtp",
                                              "sepa",
                                              "sepa_instant",
                                              "swift",
                                              "onchain",
                                              "internal",
                                              "card"
                                            ]
                                          },
                                          "netAmount": {
                                            "type": "string",
                                            "pattern": "^(0|-?[1-9][0-9]*)$"
                                          },
                                          "feeFacts": {
                                            "type": "object",
                                            "maxProperties": 20,
                                            "additionalProperties": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]*)$"
                                            }
                                          },
                                          "evidence": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 20,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "kind",
                                                "ref"
                                              ],
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "tap_message",
                                                    "x402_receipt",
                                                    "chain_tx",
                                                    "signed_doc",
                                                    "stripe_object",
                                                    "other"
                                                  ]
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "signer": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "billing": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "contractId",
                                          "activityKey",
                                          "occurrenceKey",
                                          "sourceFactId",
                                          "effectiveAt",
                                          "phase"
                                        ],
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "obligationKey": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "obligationKey"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "period": {
                                                "type": "object",
                                                "properties": {
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "through": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "from",
                                                  "through"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "period"
                                            ]
                                          }
                                        ],
                                        "properties": {
                                          "contractId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "activityKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "occurrenceKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "obligationKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "sourceFactId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "effectiveAt": {
                                            "type": "string",
                                            "format": "date-time"
                                          },
                                          "phase": {
                                            "const": "billing"
                                          },
                                          "dueDate": {
                                            "type": "string",
                                            "format": "date"
                                          },
                                          "exchangeRate": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "base",
                                              "quote",
                                              "date",
                                              "numerator",
                                              "denominator",
                                              "evidence"
                                            ],
                                            "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                            "properties": {
                                              "base": {
                                                "type": "string",
                                                "pattern": "^[A-Z]{3}$"
                                              },
                                              "quote": {
                                                "type": "string",
                                                "pattern": "^[A-Z]{3}$"
                                              },
                                              "date": {
                                                "type": "string",
                                                "format": "date"
                                              },
                                              "numerator": {
                                                "type": "string",
                                                "pattern": "^[1-9][0-9]*$"
                                              },
                                              "denominator": {
                                                "type": "string",
                                                "pattern": "^[1-9][0-9]*$"
                                              },
                                              "evidence": {
                                                "type": "array",
                                                "minItems": 1,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string"
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          },
                                          "period": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "from",
                                              "through"
                                            ],
                                            "properties": {
                                              "from": {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              "through": {
                                                "type": "string",
                                                "format": "date-time"
                                              }
                                            }
                                          },
                                          "facts": {
                                            "type": "object",
                                            "maxProperties": 100,
                                            "additionalProperties": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "occurrenceId"
                                                  ],
                                                  "properties": {
                                                    "occurrenceId": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "claimId",
                                                    "component"
                                                  ],
                                                  "properties": {
                                                    "claimId": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "component": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "originLedgerId",
                                                        "accountCode"
                                                      ],
                                                      "properties": {
                                                        "originLedgerId": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "accountCode": {
                                                          "type": "integer"
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              ]
                                            }
                                          },
                                          "evidence": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "billing": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "service": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "acceptance": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "economic": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "payment": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "financialAccountId",
                                          "direction",
                                          "amount",
                                          "currency",
                                          "partyId",
                                          "effectiveAt",
                                          "sourceFactId",
                                          "evidence"
                                        ],
                                        "properties": {
                                          "financialAccountId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "direction": {
                                            "enum": [
                                              "in",
                                              "out"
                                            ]
                                          },
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^[1-9][0-9]*$"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "partyId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "effectiveAt": {
                                            "type": "string",
                                            "format": "date-time"
                                          },
                                          "sourceFactId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "evidence": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 20,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "kind",
                                                "ref"
                                              ],
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "tap_message",
                                                    "x402_receipt",
                                                    "chain_tx",
                                                    "signed_doc",
                                                    "stripe_object",
                                                    "other"
                                                  ]
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "signer": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            ]
                          },
                          "interpretation": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              },
                              "promptVersion": {
                                "type": "string",
                                "minLength": 1
                              },
                              "buyer": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Exact observed buyer; historical proposals without this field remain review cases."
                              },
                              "spans": {
                                "type": "array",
                                "maxItems": 1000,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "cid",
                              "promptVersion",
                              "spans"
                            ]
                          },
                          "preview": {
                            "description": "Read-only ordinary activity or priced-rights preparation, when validation succeeds."
                          }
                        },
                        "oneOf": [
                          {
                            "properties": {
                              "disposition": {
                                "const": "ready"
                              },
                              "missing": {
                                "maxItems": 0
                              },
                              "lines": {
                                "minItems": 1
                              }
                            },
                            "required": [
                              "command",
                              "contract",
                              "currency",
                              "totalMinor"
                            ]
                          },
                          {
                            "properties": {
                              "disposition": {
                                "enum": [
                                  "needs_information",
                                  "duplicate",
                                  "unsupported"
                                ]
                              }
                            },
                            "not": {
                              "required": [
                                "command"
                              ]
                            }
                          }
                        ]
                      },
                      "invoiceCorrection": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "principal": {
                            "type": "string"
                          },
                          "provenance": {
                            "const": "caller_selected_source_spans"
                          },
                          "choices": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "headers": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "vendor": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "buyer": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "externalId": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "date": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "total": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  }
                                },
                                "required": [
                                  "vendor",
                                  "buyer",
                                  "externalId",
                                  "date",
                                  "currency",
                                  "total"
                                ]
                              },
                              "service": {
                                "enum": [
                                  "delivered",
                                  "not_delivered",
                                  "unclear"
                                ]
                              },
                              "rows": {
                                "type": "array",
                                "maxItems": 64,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "role": {
                                      "enum": [
                                        "charge",
                                        "tax",
                                        "summary",
                                        "other",
                                        "unclear"
                                      ]
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^(?:none|v[0-9]{1,3})$"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "headers",
                              "service",
                              "rows"
                            ]
                          }
                        },
                        "required": [
                          "at",
                          "principal",
                          "provenance",
                          "choices"
                        ]
                      },
                      "proposalRevision": {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 8
                      },
                      "proposalHistory": {
                        "type": "array",
                        "maxItems": 7,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "principal": {
                              "type": "string"
                            },
                            "expenseTargets": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "contractId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "activityKey": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  }
                                },
                                "required": [
                                  "contractId",
                                  "activityKey"
                                ]
                              }
                            },
                            "proposal": {
                              "type": "object",
                              "additionalProperties": false,
                              "description": "Frozen source-backed expense proposal. Proposal generation creates no financial entries.",
                              "required": [
                                "disposition",
                                "source",
                                "missing",
                                "lines"
                              ],
                              "properties": {
                                "disposition": {
                                  "enum": [
                                    "ready",
                                    "needs_information",
                                    "duplicate",
                                    "unsupported"
                                  ]
                                },
                                "source": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "documentId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "documentId",
                                    "cid"
                                  ]
                                },
                                "missing": {
                                  "type": "array",
                                  "maxItems": 100,
                                  "items": {
                                    "type": "string",
                                    "maxLength": 500
                                  }
                                },
                                "lines": {
                                  "type": "array",
                                  "maxItems": 500,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "index": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "description": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^[0-9]+$"
                                      }
                                    },
                                    "required": [
                                      "index",
                                      "description",
                                      "amountMinor"
                                    ]
                                  }
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "totalMinor": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                },
                                "matchedOccurrenceId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An existing matching economic fact."
                                },
                                "contract": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "contractId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "documentId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "contractId",
                                    "documentId",
                                    "cid"
                                  ]
                                },
                                "command": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "description": "Complete ordinary public command envelope; present only when ready.",
                                      "required": [
                                        "name",
                                        "input",
                                        "source_document_id",
                                        "effective_at",
                                        "idempotency_key"
                                      ],
                                      "properties": {
                                        "name": {
                                          "const": "contracts.record"
                                        },
                                        "source_document_id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "effective_at": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date-time"
                                        },
                                        "idempotency_key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 256
                                        },
                                        "input": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "contractId",
                                            "activityKey",
                                            "occurrenceKey",
                                            "sourceFactId",
                                            "effectiveAt",
                                            "facts",
                                            "evidence"
                                          ],
                                          "properties": {
                                            "contractId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "activityKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "occurrenceKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "sourceFactId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "effectiveAt": {
                                              "type": "string",
                                              "minLength": 1,
                                              "format": "date-time"
                                            },
                                            "phase": {
                                              "const": "billing"
                                            },
                                            "obligationKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "facts": {
                                              "type": "object",
                                              "maxProperties": 100,
                                              "additionalProperties": {
                                                "type": "string"
                                              }
                                            },
                                            "evidence": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "service"
                                              ],
                                              "properties": {
                                                "billing": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 1,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "kind": {
                                                        "const": "other"
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ]
                                                  }
                                                },
                                                "service": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 1,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "kind": {
                                                        "const": "other"
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ]
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "description": "Complete ordinary public command envelope; present only when ready.",
                                      "required": [
                                        "name",
                                        "input",
                                        "source_document_id",
                                        "effective_at",
                                        "idempotency_key"
                                      ],
                                      "properties": {
                                        "name": {
                                          "const": "receipts.record"
                                        },
                                        "source_document_id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "effective_at": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date-time"
                                        },
                                        "idempotency_key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 256
                                        },
                                        "input": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "billing",
                                            "payment"
                                          ],
                                          "properties": {
                                            "processing": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "rail",
                                                "netAmount",
                                                "evidence"
                                              ],
                                              "properties": {
                                                "rail": {
                                                  "enum": [
                                                    "ach",
                                                    "ach_same_day",
                                                    "fedwire",
                                                    "rtp",
                                                    "sepa",
                                                    "sepa_instant",
                                                    "swift",
                                                    "onchain",
                                                    "internal",
                                                    "card"
                                                  ]
                                                },
                                                "netAmount": {
                                                  "type": "string",
                                                  "pattern": "^(0|-?[1-9][0-9]*)$"
                                                },
                                                "feeFacts": {
                                                  "type": "object",
                                                  "maxProperties": 20,
                                                  "additionalProperties": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]*)$"
                                                  }
                                                },
                                                "evidence": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 20,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ],
                                                    "properties": {
                                                      "kind": {
                                                        "enum": [
                                                          "tap_message",
                                                          "x402_receipt",
                                                          "chain_tx",
                                                          "signed_doc",
                                                          "stripe_object",
                                                          "other"
                                                        ]
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "signer": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "billing": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "contractId",
                                                "activityKey",
                                                "occurrenceKey",
                                                "sourceFactId",
                                                "effectiveAt",
                                                "phase"
                                              ],
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "obligationKey": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "obligationKey"
                                                  ]
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "period": {
                                                      "type": "object",
                                                      "properties": {
                                                        "from": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "through": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "from",
                                                        "through"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "period"
                                                  ]
                                                }
                                              ],
                                              "properties": {
                                                "contractId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "activityKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "occurrenceKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "obligationKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "sourceFactId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "effectiveAt": {
                                                  "type": "string",
                                                  "format": "date-time"
                                                },
                                                "phase": {
                                                  "const": "billing"
                                                },
                                                "dueDate": {
                                                  "type": "string",
                                                  "format": "date"
                                                },
                                                "exchangeRate": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "base",
                                                    "quote",
                                                    "date",
                                                    "numerator",
                                                    "denominator",
                                                    "evidence"
                                                  ],
                                                  "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                                  "properties": {
                                                    "base": {
                                                      "type": "string",
                                                      "pattern": "^[A-Z]{3}$"
                                                    },
                                                    "quote": {
                                                      "type": "string",
                                                      "pattern": "^[A-Z]{3}$"
                                                    },
                                                    "date": {
                                                      "type": "string",
                                                      "format": "date"
                                                    },
                                                    "numerator": {
                                                      "type": "string",
                                                      "pattern": "^[1-9][0-9]*$"
                                                    },
                                                    "denominator": {
                                                      "type": "string",
                                                      "pattern": "^[1-9][0-9]*$"
                                                    },
                                                    "evidence": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string"
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                },
                                                "period": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "from",
                                                    "through"
                                                  ],
                                                  "properties": {
                                                    "from": {
                                                      "type": "string",
                                                      "format": "date-time"
                                                    },
                                                    "through": {
                                                      "type": "string",
                                                      "format": "date-time"
                                                    }
                                                  }
                                                },
                                                "facts": {
                                                  "type": "object",
                                                  "maxProperties": 100,
                                                  "additionalProperties": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string"
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "occurrenceId"
                                                        ],
                                                        "properties": {
                                                          "occurrenceId": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "claimId",
                                                          "component"
                                                        ],
                                                        "properties": {
                                                          "claimId": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "component": {
                                                            "type": "object",
                                                            "additionalProperties": false,
                                                            "required": [
                                                              "originLedgerId",
                                                              "accountCode"
                                                            ],
                                                            "properties": {
                                                              "originLedgerId": {
                                                                "type": "string",
                                                                "minLength": 1
                                                              },
                                                              "accountCode": {
                                                                "type": "integer"
                                                              }
                                                            }
                                                          }
                                                        }
                                                      }
                                                    ]
                                                  }
                                                },
                                                "evidence": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "billing": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "service": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "acceptance": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "economic": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "payment": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "financialAccountId",
                                                "direction",
                                                "amount",
                                                "currency",
                                                "partyId",
                                                "effectiveAt",
                                                "sourceFactId",
                                                "evidence"
                                              ],
                                              "properties": {
                                                "financialAccountId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "direction": {
                                                  "enum": [
                                                    "in",
                                                    "out"
                                                  ]
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^[1-9][0-9]*$"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "partyId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "effectiveAt": {
                                                  "type": "string",
                                                  "format": "date-time"
                                                },
                                                "sourceFactId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "evidence": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 20,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ],
                                                    "properties": {
                                                      "kind": {
                                                        "enum": [
                                                          "tap_message",
                                                          "x402_receipt",
                                                          "chain_tx",
                                                          "signed_doc",
                                                          "stripe_object",
                                                          "other"
                                                        ]
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "signer": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  ]
                                },
                                "interpretation": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "promptVersion": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "buyer": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "Exact observed buyer; historical proposals without this field remain review cases."
                                    },
                                    "spans": {
                                      "type": "array",
                                      "maxItems": 1000,
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "start": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "end": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 65536
                                          },
                                          "text": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "start",
                                          "end",
                                          "text"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "cid",
                                    "promptVersion",
                                    "spans"
                                  ]
                                },
                                "preview": {
                                  "description": "Read-only ordinary activity or priced-rights preparation, when validation succeeds."
                                }
                              },
                              "oneOf": [
                                {
                                  "properties": {
                                    "disposition": {
                                      "const": "ready"
                                    },
                                    "missing": {
                                      "maxItems": 0
                                    },
                                    "lines": {
                                      "minItems": 1
                                    }
                                  },
                                  "required": [
                                    "command",
                                    "contract",
                                    "currency",
                                    "totalMinor"
                                  ]
                                },
                                {
                                  "properties": {
                                    "disposition": {
                                      "enum": [
                                        "needs_information",
                                        "duplicate",
                                        "unsupported"
                                      ]
                                    }
                                  },
                                  "not": {
                                    "required": [
                                      "command"
                                    ]
                                  }
                                }
                              ]
                            },
                            "invoiceCorrection": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "at": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "principal": {
                                  "type": "string"
                                },
                                "provenance": {
                                  "const": "caller_selected_source_spans"
                                },
                                "choices": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "headers": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "vendor": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "buyer": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "externalId": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "date": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "currency": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "total": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        }
                                      },
                                      "required": [
                                        "vendor",
                                        "buyer",
                                        "externalId",
                                        "date",
                                        "currency",
                                        "total"
                                      ]
                                    },
                                    "service": {
                                      "enum": [
                                        "delivered",
                                        "not_delivered",
                                        "unclear"
                                      ]
                                    },
                                    "rows": {
                                      "type": "array",
                                      "maxItems": 64,
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "role": {
                                            "enum": [
                                              "charge",
                                              "tax",
                                              "summary",
                                              "other",
                                              "unclear"
                                            ]
                                          },
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^(?:none|v[0-9]{1,3})$"
                                          }
                                        },
                                        "required": [
                                          "role",
                                          "amount"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "headers",
                                    "service",
                                    "rows"
                                  ]
                                }
                              },
                              "required": [
                                "at",
                                "principal",
                                "provenance",
                                "choices"
                              ]
                            }
                          },
                          "required": [
                            "revision",
                            "at",
                            "principal"
                          ]
                        }
                      },
                      "original": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance"
                        ]
                      },
                      "failure": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "retryable": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "reason",
                          "retryable"
                        ]
                      },
                      "lastFailure": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "retryable": {
                            "type": "boolean"
                          },
                          "attempt": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 12
                          },
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "reason",
                          "retryable",
                          "attempt",
                          "at"
                        ]
                      },
                      "relationship": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "transcription",
                              "summary",
                              "related_original"
                            ]
                          },
                          "declaredBy": {
                            "type": "string"
                          },
                          "verification": {
                            "const": "unverified"
                          }
                        },
                        "required": [
                          "type",
                          "declaredBy",
                          "verification"
                        ]
                      },
                      "uploads": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "primary": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "contentType": {
                                "enum": [
                                  "application/pdf",
                                  "text/plain",
                                  "text/markdown",
                                  "text/csv",
                                  "application/json",
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760,
                                "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "status": {
                                "enum": [
                                  "awaiting_upload",
                                  "uploaded",
                                  "expired"
                                ]
                              },
                              "documentId": {
                                "type": "string"
                              },
                              "cid": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived upload credential. Send exact bytes to this URL with the returned method and contentType; no OAuth header is required. Present only in the response of the command that issued it (ingestions.start, ingestions.attach_original, ingestions.reissue_upload); replays and reads omit it, so call ingestions.reissue_upload for a fresh one."
                              },
                              "method": {
                                "const": "PUT",
                                "description": "Present when this response issued the upload URL."
                              }
                            },
                            "required": [
                              "filename",
                              "contentType",
                              "size",
                              "expiresAt",
                              "status"
                            ]
                          },
                          "original": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "contentType": {
                                "enum": [
                                  "application/pdf",
                                  "text/plain",
                                  "text/markdown",
                                  "text/csv",
                                  "application/json",
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760,
                                "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "status": {
                                "enum": [
                                  "awaiting_upload",
                                  "uploaded",
                                  "expired"
                                ]
                              },
                              "documentId": {
                                "type": "string"
                              },
                              "cid": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived upload credential. Send exact bytes to this URL with the returned method and contentType; no OAuth header is required. Present only in the response of the command that issued it (ingestions.start, ingestions.attach_original, ingestions.reissue_upload); replays and reads omit it, so call ingestions.reissue_upload for a fresh one."
                              },
                              "method": {
                                "const": "PUT",
                                "description": "Present when this response issued the upload URL."
                              }
                            },
                            "required": [
                              "filename",
                              "contentType",
                              "size",
                              "expiresAt",
                              "status"
                            ]
                          }
                        }
                      },
                      "revisions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "startedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "business": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "legalName": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "name",
                                "legalName"
                              ]
                            },
                            "completedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "status": {
                              "enum": [
                                "processing",
                                "completed",
                                "failed"
                              ]
                            },
                            "sources": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "documentId": {
                                    "type": "string"
                                  },
                                  "cid": {
                                    "type": "string"
                                  },
                                  "format": {
                                    "enum": [
                                      "markdown",
                                      "text",
                                      "document"
                                    ]
                                  },
                                  "provenance": {
                                    "enum": [
                                      "caller_supplied_unverified",
                                      "registered_bytes"
                                    ]
                                  },
                                  "role": {
                                    "enum": [
                                      "primary",
                                      "original"
                                    ]
                                  }
                                },
                                "required": [
                                  "documentId",
                                  "cid",
                                  "format",
                                  "provenance",
                                  "role"
                                ]
                              }
                            },
                            "failure": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "reason": {
                                  "type": "string"
                                },
                                "retryable": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "reason",
                                "retryable"
                              ]
                            },
                            "invoiceSelection": {
                              "type": "object",
                              "additionalProperties": false,
                              "description": "Observed source-span choices, bound to the committed UTF-8 extraction. Spans versions pick candidate indices; fields versions carry verified UTF-8 spans for header and payment-identity values. Choice probability is not financial accuracy or authorization.",
                              "properties": {
                                "textCid": {
                                  "type": "string"
                                },
                                "promptVersion": {
                                  "enum": [
                                    "invoice-fields-v5",
                                    "receipt-fields-v5",
                                    "invoice-spans-v1",
                                    "receipt-spans-v1",
                                    "invoice-fields-v1",
                                    "receipt-fields-v1",
                                    "invoice-fields-v2",
                                    "receipt-fields-v2",
                                    "invoice-fields-v3",
                                    "receipt-fields-v3",
                                    "invoice-fields-v4",
                                    "receipt-fields-v4"
                                  ]
                                },
                                "headers": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "vendor": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "buyer": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "externalId": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "date": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "currency": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "total": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "vendor",
                                    "buyer",
                                    "externalId",
                                    "date",
                                    "currency",
                                    "total"
                                  ]
                                },
                                "provider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "The model that chose header values and optional source-line amounts: Clef for spans versions, Clairic for fields versions.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/cloudflare/clef-flash",
                                        "@cf/cloudflare/clef",
                                        "@cf/cloudflare/clairic"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "judgmentProvider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "Fields versions only: the Clef model or bounded Flash-to-Clef cascade that answered currency, service, payment status and row judgments. Optional Clairic amount reads are accounted in provider.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/cloudflare/clef-flash",
                                        "@cf/cloudflare/clef",
                                        "@cf/cloudflare/clef-flash+clef/uncertain-groups-v1"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "groupingProvider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "Measured optional grouping attempt, including a failed attempt that retains physical rows.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/moonshotai/kimi-k2.6"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "rowGroups": {
                                  "type": "array",
                                  "maxItems": 1024,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "firstRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "lastRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "anchorRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "description": {
                                        "type": "object",
                                        "properties": {
                                          "start": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 65536
                                          },
                                          "end": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 65536
                                          },
                                          "text": {
                                            "type": "string",
                                            "maxLength": 65536
                                          }
                                        },
                                        "required": [
                                          "start",
                                          "end",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "firstRow",
                                      "lastRow",
                                      "anchorRow"
                                    ]
                                  }
                                },
                                "service": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "choice": {
                                      "type": "string",
                                      "maxLength": 32
                                    },
                                    "probability": {
                                      "type": "string",
                                      "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                    },
                                    "span": {
                                      "type": "object",
                                      "properties": {
                                        "start": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 65536
                                        },
                                        "end": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 65536
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 65536
                                        }
                                      },
                                      "required": [
                                        "start",
                                        "end",
                                        "text"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "choice",
                                    "probability"
                                  ]
                                },
                                "payment": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "status": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "externalId": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "last4": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "status",
                                    "externalId",
                                    "last4"
                                  ]
                                },
                                "rows": {
                                  "type": "array",
                                  "maxItems": 1024,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "role": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "choice": {
                                            "type": "string",
                                            "maxLength": 32
                                          },
                                          "probability": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                          },
                                          "span": {
                                            "type": "object",
                                            "properties": {
                                              "start": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "end": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "text": {
                                                "type": "string",
                                                "maxLength": 65536
                                              }
                                            },
                                            "required": [
                                              "start",
                                              "end",
                                              "text"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "choice",
                                          "probability"
                                        ]
                                      },
                                      "amount": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "choice": {
                                            "type": "string",
                                            "maxLength": 32
                                          },
                                          "probability": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                          },
                                          "span": {
                                            "type": "object",
                                            "properties": {
                                              "start": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "end": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "text": {
                                                "type": "string",
                                                "maxLength": 65536
                                              }
                                            },
                                            "required": [
                                              "start",
                                              "end",
                                              "text"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "choice",
                                          "probability"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "role",
                                      "amount"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "textCid",
                                "promptVersion",
                                "headers",
                                "service",
                                "rows"
                              ]
                            },
                            "extraction": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "status": {
                                  "enum": [
                                    "not_required",
                                    "extracted",
                                    "incomplete"
                                  ]
                                },
                                "method": {
                                  "enum": [
                                    "provided_text",
                                    "native_pdf",
                                    "image_ocr",
                                    "pdf_ocr"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 65536,
                                  "description": "Returned only after source-document authorization; raw history contains annex references."
                                },
                                "textBytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 65536
                                },
                                "source": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "documentId": {
                                      "type": "string"
                                    },
                                    "cid": {
                                      "type": "string"
                                    },
                                    "format": {
                                      "enum": [
                                        "markdown",
                                        "text",
                                        "document"
                                      ]
                                    },
                                    "provenance": {
                                      "enum": [
                                        "caller_supplied_unverified",
                                        "registered_bytes"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "documentId",
                                    "cid",
                                    "format",
                                    "provenance"
                                  ]
                                },
                                "derived": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "cid": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "cid"
                                  ]
                                },
                                "pageCount": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ],
                                  "minimum": 1,
                                  "maximum": 50
                                },
                                "locations": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "page": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ],
                                        "minimum": 1
                                      },
                                      "start": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "end": {
                                        "type": "integer",
                                        "minimum": 0
                                      }
                                    },
                                    "required": [
                                      "page",
                                      "start",
                                      "end"
                                    ]
                                  }
                                },
                                "provider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "name": {
                                      "type": "string"
                                    },
                                    "version": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version"
                                  ]
                                },
                                "usage": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "conversionTokens": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "description": "Estimated native conversion tokens, distinct from inference usage."
                                    }
                                  },
                                  "required": [
                                    "inputTokens",
                                    "outputTokens",
                                    "latencyMs"
                                  ]
                                }
                              },
                              "required": [
                                "status",
                                "method",
                                "textBytes",
                                "source",
                                "derived",
                                "pageCount",
                                "locations",
                                "provider",
                                "usage"
                              ]
                            },
                            "classification": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "documentType": {
                                  "enum": [
                                    "invoice",
                                    "receipt",
                                    "agreement",
                                    "statement_or_remittance",
                                    "credit_or_correction",
                                    "reminder",
                                    "mixed",
                                    "other",
                                    "uncertain"
                                  ]
                                },
                                "probabilities": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "invoice": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "receipt": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "agreement": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "statement_or_remittance": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "credit_or_correction": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "reminder": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "mixed": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "other": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "uncertain": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    }
                                  },
                                  "required": [
                                    "invoice",
                                    "receipt",
                                    "agreement",
                                    "statement_or_remittance",
                                    "credit_or_correction",
                                    "reminder",
                                    "mixed",
                                    "other",
                                    "uncertain"
                                  ]
                                },
                                "model": {
                                  "type": "string"
                                },
                                "modelVersion": {
                                  "type": "string"
                                },
                                "promptVersion": {
                                  "type": "string"
                                },
                                "confidence": {
                                  "type": "string",
                                  "description": "Distribution confidence, not calibrated accuracy or permission to act."
                                },
                                "invoiceRole": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "role": {
                                      "enum": [
                                        "buyer",
                                        "seller",
                                        "neither",
                                        "unclear"
                                      ]
                                    },
                                    "probabilities": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "buyer": {
                                          "type": "string"
                                        },
                                        "seller": {
                                          "type": "string"
                                        },
                                        "neither": {
                                          "type": "string"
                                        },
                                        "unclear": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "buyer",
                                        "seller",
                                        "neither",
                                        "unclear"
                                      ]
                                    },
                                    "confidence": {
                                      "type": "string"
                                    },
                                    "promptVersion": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "probabilities",
                                    "confidence",
                                    "promptVersion"
                                  ]
                                },
                                "usage": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                }
                              },
                              "required": [
                                "documentType",
                                "probabilities",
                                "model",
                                "modelVersion",
                                "promptVersion"
                              ]
                            }
                          },
                          "required": [
                            "revision",
                            "startedAt",
                            "business",
                            "status",
                            "sources"
                          ]
                        }
                      }
                    },
                    "required": [
                      "ingestionId",
                      "createdAt",
                      "status",
                      "uploads",
                      "revisions"
                    ],
                    "x-relative-urls": [
                      "/uploads/primary/url",
                      "/uploads/original/url"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "ingestionId": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "status": {
                        "enum": [
                          "awaiting_upload",
                          "queued",
                          "processing",
                          "completed",
                          "failed"
                        ]
                      },
                      "source": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance"
                        ]
                      },
                      "expenseTargets": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 20,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "contractId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "activityKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": [
                            "contractId",
                            "activityKey"
                          ]
                        }
                      },
                      "mode": {
                        "enum": [
                          "propose",
                          "auto_record"
                        ]
                      },
                      "recordingPolicy": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "minimumConfidencePercent": {
                            "type": "integer",
                            "minimum": 60,
                            "maximum": 100
                          },
                          "fundingAccounts": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "financialAccountId",
                                "currency",
                                "last4",
                                "kind",
                                "glAccountCode"
                              ],
                              "properties": {
                                "financialAccountId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "last4": {
                                  "type": "string",
                                  "pattern": "^[0-9]{4}$"
                                },
                                "kind": {
                                  "enum": [
                                    "checking",
                                    "savings",
                                    "card",
                                    "wallet",
                                    "other"
                                  ]
                                },
                                "glAccountCode": {
                                  "enum": [
                                    1110,
                                    1310,
                                    1410,
                                    2190,
                                    2135
                                  ]
                                },
                                "ownerPartyId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "providerPartyId": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            }
                          },
                          "targets": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "contractId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "activityKey": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "cid": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              "required": [
                                "contractId",
                                "activityKey",
                                "cid"
                              ]
                            }
                          }
                        },
                        "required": [
                          "minimumConfidencePercent",
                          "targets"
                        ]
                      },
                      "execution": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "status": {
                            "enum": [
                              "pending",
                              "recorded",
                              "already_recorded",
                              "needs_review"
                            ]
                          },
                          "proposalRevision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8
                          },
                          "commandId": {
                            "type": "string",
                            "description": "Actual ordinary financial command receipt."
                          },
                          "occurrenceId": {
                            "type": "string",
                            "description": "An already recorded matching economic fact."
                          },
                          "reason": {
                            "type": "string",
                            "description": "Why automatic recording requires review."
                          }
                        },
                        "required": [
                          "status",
                          "proposalRevision"
                        ],
                        "description": "Durable financial recording disposition and actual ordinary command receipt reference."
                      },
                      "proposal": {
                        "type": "object",
                        "additionalProperties": false,
                        "description": "Frozen source-backed expense proposal. Proposal generation creates no financial entries.",
                        "required": [
                          "disposition",
                          "source",
                          "missing",
                          "lines"
                        ],
                        "properties": {
                          "disposition": {
                            "enum": [
                              "ready",
                              "needs_information",
                              "duplicate",
                              "unsupported"
                            ]
                          },
                          "source": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "documentId",
                              "cid"
                            ]
                          },
                          "missing": {
                            "type": "array",
                            "maxItems": 100,
                            "items": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "lines": {
                            "type": "array",
                            "maxItems": 500,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "index": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                }
                              },
                              "required": [
                                "index",
                                "description",
                                "amountMinor"
                              ]
                            }
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^[0-9]+$"
                          },
                          "matchedOccurrenceId": {
                            "type": "string",
                            "minLength": 1,
                            "description": "An existing matching economic fact."
                          },
                          "contract": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "contractId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "documentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "contractId",
                              "documentId",
                              "cid"
                            ]
                          },
                          "command": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "Complete ordinary public command envelope; present only when ready.",
                                "required": [
                                  "name",
                                  "input",
                                  "source_document_id",
                                  "effective_at",
                                  "idempotency_key"
                                ],
                                "properties": {
                                  "name": {
                                    "const": "contracts.record"
                                  },
                                  "source_document_id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effective_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date-time"
                                  },
                                  "idempotency_key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 256
                                  },
                                  "input": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "contractId",
                                      "activityKey",
                                      "occurrenceKey",
                                      "sourceFactId",
                                      "effectiveAt",
                                      "facts",
                                      "evidence"
                                    ],
                                    "properties": {
                                      "contractId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "activityKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "occurrenceKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "sourceFactId": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "effectiveAt": {
                                        "type": "string",
                                        "minLength": 1,
                                        "format": "date-time"
                                      },
                                      "phase": {
                                        "const": "billing"
                                      },
                                      "obligationKey": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "facts": {
                                        "type": "object",
                                        "maxProperties": 100,
                                        "additionalProperties": {
                                          "type": "string"
                                        }
                                      },
                                      "evidence": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "service"
                                        ],
                                        "properties": {
                                          "billing": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 1,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "const": "other"
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "ref"
                                              ]
                                            }
                                          },
                                          "service": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 1,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "properties": {
                                                "kind": {
                                                  "const": "other"
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "ref"
                                              ]
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "description": "Complete ordinary public command envelope; present only when ready.",
                                "required": [
                                  "name",
                                  "input",
                                  "source_document_id",
                                  "effective_at",
                                  "idempotency_key"
                                ],
                                "properties": {
                                  "name": {
                                    "const": "receipts.record"
                                  },
                                  "source_document_id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effective_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "format": "date-time"
                                  },
                                  "idempotency_key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 256
                                  },
                                  "input": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "billing",
                                      "payment"
                                    ],
                                    "properties": {
                                      "processing": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "rail",
                                          "netAmount",
                                          "evidence"
                                        ],
                                        "properties": {
                                          "rail": {
                                            "enum": [
                                              "ach",
                                              "ach_same_day",
                                              "fedwire",
                                              "rtp",
                                              "sepa",
                                              "sepa_instant",
                                              "swift",
                                              "onchain",
                                              "internal",
                                              "card"
                                            ]
                                          },
                                          "netAmount": {
                                            "type": "string",
                                            "pattern": "^(0|-?[1-9][0-9]*)$"
                                          },
                                          "feeFacts": {
                                            "type": "object",
                                            "maxProperties": 20,
                                            "additionalProperties": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]*)$"
                                            }
                                          },
                                          "evidence": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 20,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "kind",
                                                "ref"
                                              ],
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "tap_message",
                                                    "x402_receipt",
                                                    "chain_tx",
                                                    "signed_doc",
                                                    "stripe_object",
                                                    "other"
                                                  ]
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "signer": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "billing": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "contractId",
                                          "activityKey",
                                          "occurrenceKey",
                                          "sourceFactId",
                                          "effectiveAt",
                                          "phase"
                                        ],
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "obligationKey": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "obligationKey"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "period": {
                                                "type": "object",
                                                "properties": {
                                                  "from": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "through": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                },
                                                "required": [
                                                  "from",
                                                  "through"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "period"
                                            ]
                                          }
                                        ],
                                        "properties": {
                                          "contractId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "activityKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "occurrenceKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "obligationKey": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "sourceFactId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "effectiveAt": {
                                            "type": "string",
                                            "format": "date-time"
                                          },
                                          "phase": {
                                            "const": "billing"
                                          },
                                          "dueDate": {
                                            "type": "string",
                                            "format": "date"
                                          },
                                          "exchangeRate": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "base",
                                              "quote",
                                              "date",
                                              "numerator",
                                              "denominator",
                                              "evidence"
                                            ],
                                            "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                            "properties": {
                                              "base": {
                                                "type": "string",
                                                "pattern": "^[A-Z]{3}$"
                                              },
                                              "quote": {
                                                "type": "string",
                                                "pattern": "^[A-Z]{3}$"
                                              },
                                              "date": {
                                                "type": "string",
                                                "format": "date"
                                              },
                                              "numerator": {
                                                "type": "string",
                                                "pattern": "^[1-9][0-9]*$"
                                              },
                                              "denominator": {
                                                "type": "string",
                                                "pattern": "^[1-9][0-9]*$"
                                              },
                                              "evidence": {
                                                "type": "array",
                                                "minItems": 1,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string"
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          },
                                          "period": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "from",
                                              "through"
                                            ],
                                            "properties": {
                                              "from": {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              "through": {
                                                "type": "string",
                                                "format": "date-time"
                                              }
                                            }
                                          },
                                          "facts": {
                                            "type": "object",
                                            "maxProperties": 100,
                                            "additionalProperties": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "occurrenceId"
                                                  ],
                                                  "properties": {
                                                    "occurrenceId": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "claimId",
                                                    "component"
                                                  ],
                                                  "properties": {
                                                    "claimId": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "component": {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "originLedgerId",
                                                        "accountCode"
                                                      ],
                                                      "properties": {
                                                        "originLedgerId": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "accountCode": {
                                                          "type": "integer"
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              ]
                                            }
                                          },
                                          "evidence": {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "properties": {
                                              "billing": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "service": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "acceptance": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              },
                                              "economic": {
                                                "type": "array",
                                                "minItems": 1,
                                                "maxItems": 20,
                                                "items": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "kind",
                                                    "ref"
                                                  ],
                                                  "properties": {
                                                    "kind": {
                                                      "enum": [
                                                        "tap_message",
                                                        "x402_receipt",
                                                        "chain_tx",
                                                        "signed_doc",
                                                        "stripe_object",
                                                        "other"
                                                      ]
                                                    },
                                                    "ref": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    },
                                                    "signer": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "payment": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "financialAccountId",
                                          "direction",
                                          "amount",
                                          "currency",
                                          "partyId",
                                          "effectiveAt",
                                          "sourceFactId",
                                          "evidence"
                                        ],
                                        "properties": {
                                          "financialAccountId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "direction": {
                                            "enum": [
                                              "in",
                                              "out"
                                            ]
                                          },
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^[1-9][0-9]*$"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "partyId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "effectiveAt": {
                                            "type": "string",
                                            "format": "date-time"
                                          },
                                          "sourceFactId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "evidence": {
                                            "type": "array",
                                            "minItems": 1,
                                            "maxItems": 20,
                                            "items": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "kind",
                                                "ref"
                                              ],
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "tap_message",
                                                    "x402_receipt",
                                                    "chain_tx",
                                                    "signed_doc",
                                                    "stripe_object",
                                                    "other"
                                                  ]
                                                },
                                                "ref": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "signer": {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            ]
                          },
                          "interpretation": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "cid": {
                                "type": "string",
                                "minLength": 1
                              },
                              "promptVersion": {
                                "type": "string",
                                "minLength": 1
                              },
                              "buyer": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Exact observed buyer; historical proposals without this field remain review cases."
                              },
                              "spans": {
                                "type": "array",
                                "maxItems": 1000,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "start": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "end": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 65536
                                    },
                                    "text": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "start",
                                    "end",
                                    "text"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "cid",
                              "promptVersion",
                              "spans"
                            ]
                          },
                          "preview": {
                            "description": "Read-only ordinary activity or priced-rights preparation, when validation succeeds."
                          }
                        },
                        "oneOf": [
                          {
                            "properties": {
                              "disposition": {
                                "const": "ready"
                              },
                              "missing": {
                                "maxItems": 0
                              },
                              "lines": {
                                "minItems": 1
                              }
                            },
                            "required": [
                              "command",
                              "contract",
                              "currency",
                              "totalMinor"
                            ]
                          },
                          {
                            "properties": {
                              "disposition": {
                                "enum": [
                                  "needs_information",
                                  "duplicate",
                                  "unsupported"
                                ]
                              }
                            },
                            "not": {
                              "required": [
                                "command"
                              ]
                            }
                          }
                        ]
                      },
                      "invoiceCorrection": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "principal": {
                            "type": "string"
                          },
                          "provenance": {
                            "const": "caller_selected_source_spans"
                          },
                          "choices": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "headers": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "vendor": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "buyer": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "externalId": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "date": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  },
                                  "total": {
                                    "type": "string",
                                    "pattern": "^(?:none|v[0-9]{1,3})$"
                                  }
                                },
                                "required": [
                                  "vendor",
                                  "buyer",
                                  "externalId",
                                  "date",
                                  "currency",
                                  "total"
                                ]
                              },
                              "service": {
                                "enum": [
                                  "delivered",
                                  "not_delivered",
                                  "unclear"
                                ]
                              },
                              "rows": {
                                "type": "array",
                                "maxItems": 64,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "role": {
                                      "enum": [
                                        "charge",
                                        "tax",
                                        "summary",
                                        "other",
                                        "unclear"
                                      ]
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^(?:none|v[0-9]{1,3})$"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "headers",
                              "service",
                              "rows"
                            ]
                          }
                        },
                        "required": [
                          "at",
                          "principal",
                          "provenance",
                          "choices"
                        ]
                      },
                      "proposalRevision": {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 8
                      },
                      "proposalHistory": {
                        "type": "array",
                        "maxItems": 7,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 7
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "principal": {
                              "type": "string"
                            },
                            "expenseTargets": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "contractId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "activityKey": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  }
                                },
                                "required": [
                                  "contractId",
                                  "activityKey"
                                ]
                              }
                            },
                            "proposal": {
                              "type": "object",
                              "additionalProperties": false,
                              "description": "Frozen source-backed expense proposal. Proposal generation creates no financial entries.",
                              "required": [
                                "disposition",
                                "source",
                                "missing",
                                "lines"
                              ],
                              "properties": {
                                "disposition": {
                                  "enum": [
                                    "ready",
                                    "needs_information",
                                    "duplicate",
                                    "unsupported"
                                  ]
                                },
                                "source": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "documentId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "documentId",
                                    "cid"
                                  ]
                                },
                                "missing": {
                                  "type": "array",
                                  "maxItems": 100,
                                  "items": {
                                    "type": "string",
                                    "maxLength": 500
                                  }
                                },
                                "lines": {
                                  "type": "array",
                                  "maxItems": 500,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "index": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "description": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^[0-9]+$"
                                      }
                                    },
                                    "required": [
                                      "index",
                                      "description",
                                      "amountMinor"
                                    ]
                                  }
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "totalMinor": {
                                  "type": "string",
                                  "pattern": "^[0-9]+$"
                                },
                                "matchedOccurrenceId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An existing matching economic fact."
                                },
                                "contract": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "contractId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "documentId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "contractId",
                                    "documentId",
                                    "cid"
                                  ]
                                },
                                "command": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "description": "Complete ordinary public command envelope; present only when ready.",
                                      "required": [
                                        "name",
                                        "input",
                                        "source_document_id",
                                        "effective_at",
                                        "idempotency_key"
                                      ],
                                      "properties": {
                                        "name": {
                                          "const": "contracts.record"
                                        },
                                        "source_document_id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "effective_at": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date-time"
                                        },
                                        "idempotency_key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 256
                                        },
                                        "input": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "contractId",
                                            "activityKey",
                                            "occurrenceKey",
                                            "sourceFactId",
                                            "effectiveAt",
                                            "facts",
                                            "evidence"
                                          ],
                                          "properties": {
                                            "contractId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "activityKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "occurrenceKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "sourceFactId": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "effectiveAt": {
                                              "type": "string",
                                              "minLength": 1,
                                              "format": "date-time"
                                            },
                                            "phase": {
                                              "const": "billing"
                                            },
                                            "obligationKey": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "facts": {
                                              "type": "object",
                                              "maxProperties": 100,
                                              "additionalProperties": {
                                                "type": "string"
                                              }
                                            },
                                            "evidence": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "service"
                                              ],
                                              "properties": {
                                                "billing": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 1,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "kind": {
                                                        "const": "other"
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ]
                                                  }
                                                },
                                                "service": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 1,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "properties": {
                                                      "kind": {
                                                        "const": "other"
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ]
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "description": "Complete ordinary public command envelope; present only when ready.",
                                      "required": [
                                        "name",
                                        "input",
                                        "source_document_id",
                                        "effective_at",
                                        "idempotency_key"
                                      ],
                                      "properties": {
                                        "name": {
                                          "const": "receipts.record"
                                        },
                                        "source_document_id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "effective_at": {
                                          "type": "string",
                                          "minLength": 1,
                                          "format": "date-time"
                                        },
                                        "idempotency_key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 256
                                        },
                                        "input": {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "billing",
                                            "payment"
                                          ],
                                          "properties": {
                                            "processing": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "rail",
                                                "netAmount",
                                                "evidence"
                                              ],
                                              "properties": {
                                                "rail": {
                                                  "enum": [
                                                    "ach",
                                                    "ach_same_day",
                                                    "fedwire",
                                                    "rtp",
                                                    "sepa",
                                                    "sepa_instant",
                                                    "swift",
                                                    "onchain",
                                                    "internal",
                                                    "card"
                                                  ]
                                                },
                                                "netAmount": {
                                                  "type": "string",
                                                  "pattern": "^(0|-?[1-9][0-9]*)$"
                                                },
                                                "feeFacts": {
                                                  "type": "object",
                                                  "maxProperties": 20,
                                                  "additionalProperties": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]*)$"
                                                  }
                                                },
                                                "evidence": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 20,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ],
                                                    "properties": {
                                                      "kind": {
                                                        "enum": [
                                                          "tap_message",
                                                          "x402_receipt",
                                                          "chain_tx",
                                                          "signed_doc",
                                                          "stripe_object",
                                                          "other"
                                                        ]
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "signer": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "billing": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "contractId",
                                                "activityKey",
                                                "occurrenceKey",
                                                "sourceFactId",
                                                "effectiveAt",
                                                "phase"
                                              ],
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "obligationKey": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "obligationKey"
                                                  ]
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "period": {
                                                      "type": "object",
                                                      "properties": {
                                                        "from": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "through": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "from",
                                                        "through"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "period"
                                                  ]
                                                }
                                              ],
                                              "properties": {
                                                "contractId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "activityKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "occurrenceKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "obligationKey": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "sourceFactId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "effectiveAt": {
                                                  "type": "string",
                                                  "format": "date-time"
                                                },
                                                "phase": {
                                                  "const": "billing"
                                                },
                                                "dueDate": {
                                                  "type": "string",
                                                  "format": "date"
                                                },
                                                "exchangeRate": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "base",
                                                    "quote",
                                                    "date",
                                                    "numerator",
                                                    "denominator",
                                                    "evidence"
                                                  ],
                                                  "description": "An evidenced exchange rate (1 base = numerator/denominator quote), e.g. from a bank statement. It overrides the shared rate store for this command; omit it to use the store.",
                                                  "properties": {
                                                    "base": {
                                                      "type": "string",
                                                      "pattern": "^[A-Z]{3}$"
                                                    },
                                                    "quote": {
                                                      "type": "string",
                                                      "pattern": "^[A-Z]{3}$"
                                                    },
                                                    "date": {
                                                      "type": "string",
                                                      "format": "date"
                                                    },
                                                    "numerator": {
                                                      "type": "string",
                                                      "pattern": "^[1-9][0-9]*$"
                                                    },
                                                    "denominator": {
                                                      "type": "string",
                                                      "pattern": "^[1-9][0-9]*$"
                                                    },
                                                    "evidence": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string"
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                },
                                                "period": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "from",
                                                    "through"
                                                  ],
                                                  "properties": {
                                                    "from": {
                                                      "type": "string",
                                                      "format": "date-time"
                                                    },
                                                    "through": {
                                                      "type": "string",
                                                      "format": "date-time"
                                                    }
                                                  }
                                                },
                                                "facts": {
                                                  "type": "object",
                                                  "maxProperties": 100,
                                                  "additionalProperties": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string"
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "occurrenceId"
                                                        ],
                                                        "properties": {
                                                          "occurrenceId": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "claimId",
                                                          "component"
                                                        ],
                                                        "properties": {
                                                          "claimId": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "component": {
                                                            "type": "object",
                                                            "additionalProperties": false,
                                                            "required": [
                                                              "originLedgerId",
                                                              "accountCode"
                                                            ],
                                                            "properties": {
                                                              "originLedgerId": {
                                                                "type": "string",
                                                                "minLength": 1
                                                              },
                                                              "accountCode": {
                                                                "type": "integer"
                                                              }
                                                            }
                                                          }
                                                        }
                                                      }
                                                    ]
                                                  }
                                                },
                                                "evidence": {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "properties": {
                                                    "billing": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "service": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "acceptance": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "economic": {
                                                      "type": "array",
                                                      "minItems": 1,
                                                      "maxItems": 20,
                                                      "items": {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "kind",
                                                          "ref"
                                                        ],
                                                        "properties": {
                                                          "kind": {
                                                            "enum": [
                                                              "tap_message",
                                                              "x402_receipt",
                                                              "chain_tx",
                                                              "signed_doc",
                                                              "stripe_object",
                                                              "other"
                                                            ]
                                                          },
                                                          "ref": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          },
                                                          "signer": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "payment": {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "financialAccountId",
                                                "direction",
                                                "amount",
                                                "currency",
                                                "partyId",
                                                "effectiveAt",
                                                "sourceFactId",
                                                "evidence"
                                              ],
                                              "properties": {
                                                "financialAccountId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "direction": {
                                                  "enum": [
                                                    "in",
                                                    "out"
                                                  ]
                                                },
                                                "amount": {
                                                  "type": "string",
                                                  "pattern": "^[1-9][0-9]*$"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "partyId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "effectiveAt": {
                                                  "type": "string",
                                                  "format": "date-time"
                                                },
                                                "sourceFactId": {
                                                  "type": "string",
                                                  "minLength": 1
                                                },
                                                "evidence": {
                                                  "type": "array",
                                                  "minItems": 1,
                                                  "maxItems": 20,
                                                  "items": {
                                                    "type": "object",
                                                    "additionalProperties": false,
                                                    "required": [
                                                      "kind",
                                                      "ref"
                                                    ],
                                                    "properties": {
                                                      "kind": {
                                                        "enum": [
                                                          "tap_message",
                                                          "x402_receipt",
                                                          "chain_tx",
                                                          "signed_doc",
                                                          "stripe_object",
                                                          "other"
                                                        ]
                                                      },
                                                      "ref": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "signer": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  ]
                                },
                                "interpretation": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "cid": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "promptVersion": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "buyer": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "Exact observed buyer; historical proposals without this field remain review cases."
                                    },
                                    "spans": {
                                      "type": "array",
                                      "maxItems": 1000,
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "start": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "end": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 65536
                                          },
                                          "text": {
                                            "type": "string",
                                            "minLength": 1
                                          }
                                        },
                                        "required": [
                                          "start",
                                          "end",
                                          "text"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "cid",
                                    "promptVersion",
                                    "spans"
                                  ]
                                },
                                "preview": {
                                  "description": "Read-only ordinary activity or priced-rights preparation, when validation succeeds."
                                }
                              },
                              "oneOf": [
                                {
                                  "properties": {
                                    "disposition": {
                                      "const": "ready"
                                    },
                                    "missing": {
                                      "maxItems": 0
                                    },
                                    "lines": {
                                      "minItems": 1
                                    }
                                  },
                                  "required": [
                                    "command",
                                    "contract",
                                    "currency",
                                    "totalMinor"
                                  ]
                                },
                                {
                                  "properties": {
                                    "disposition": {
                                      "enum": [
                                        "needs_information",
                                        "duplicate",
                                        "unsupported"
                                      ]
                                    }
                                  },
                                  "not": {
                                    "required": [
                                      "command"
                                    ]
                                  }
                                }
                              ]
                            },
                            "invoiceCorrection": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "at": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "principal": {
                                  "type": "string"
                                },
                                "provenance": {
                                  "const": "caller_selected_source_spans"
                                },
                                "choices": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "headers": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "vendor": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "buyer": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "externalId": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "date": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "currency": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        },
                                        "total": {
                                          "type": "string",
                                          "pattern": "^(?:none|v[0-9]{1,3})$"
                                        }
                                      },
                                      "required": [
                                        "vendor",
                                        "buyer",
                                        "externalId",
                                        "date",
                                        "currency",
                                        "total"
                                      ]
                                    },
                                    "service": {
                                      "enum": [
                                        "delivered",
                                        "not_delivered",
                                        "unclear"
                                      ]
                                    },
                                    "rows": {
                                      "type": "array",
                                      "maxItems": 64,
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "role": {
                                            "enum": [
                                              "charge",
                                              "tax",
                                              "summary",
                                              "other",
                                              "unclear"
                                            ]
                                          },
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^(?:none|v[0-9]{1,3})$"
                                          }
                                        },
                                        "required": [
                                          "role",
                                          "amount"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "headers",
                                    "service",
                                    "rows"
                                  ]
                                }
                              },
                              "required": [
                                "at",
                                "principal",
                                "provenance",
                                "choices"
                              ]
                            }
                          },
                          "required": [
                            "revision",
                            "at",
                            "principal"
                          ]
                        }
                      },
                      "original": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "format": {
                            "enum": [
                              "markdown",
                              "text",
                              "document"
                            ]
                          },
                          "provenance": {
                            "enum": [
                              "caller_supplied_unverified",
                              "registered_bytes"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "format",
                          "provenance"
                        ]
                      },
                      "failure": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "retryable": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "reason",
                          "retryable"
                        ]
                      },
                      "lastFailure": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "retryable": {
                            "type": "boolean"
                          },
                          "attempt": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 12
                          },
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "reason",
                          "retryable",
                          "attempt",
                          "at"
                        ]
                      },
                      "relationship": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "transcription",
                              "summary",
                              "related_original"
                            ]
                          },
                          "declaredBy": {
                            "type": "string"
                          },
                          "verification": {
                            "const": "unverified"
                          }
                        },
                        "required": [
                          "type",
                          "declaredBy",
                          "verification"
                        ]
                      },
                      "uploads": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "primary": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "contentType": {
                                "enum": [
                                  "application/pdf",
                                  "text/plain",
                                  "text/markdown",
                                  "text/csv",
                                  "application/json",
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760,
                                "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "status": {
                                "enum": [
                                  "awaiting_upload",
                                  "uploaded",
                                  "expired"
                                ]
                              },
                              "documentId": {
                                "type": "string"
                              },
                              "cid": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived upload credential. Send exact bytes to this URL with the returned method and contentType; no OAuth header is required. Present only in the response of the command that issued it (ingestions.start, ingestions.attach_original, ingestions.reissue_upload); replays and reads omit it, so call ingestions.reissue_upload for a fresh one."
                              },
                              "method": {
                                "const": "PUT",
                                "description": "Present when this response issued the upload URL."
                              }
                            },
                            "required": [
                              "filename",
                              "contentType",
                              "size",
                              "expiresAt",
                              "status"
                            ]
                          },
                          "original": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "contentType": {
                                "enum": [
                                  "application/pdf",
                                  "text/plain",
                                  "text/markdown",
                                  "text/csv",
                                  "application/json",
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760,
                                "description": "Exact byte length. Images are limited to 256 KiB; other files to 10 MiB."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "status": {
                                "enum": [
                                  "awaiting_upload",
                                  "uploaded",
                                  "expired"
                                ]
                              },
                              "documentId": {
                                "type": "string"
                              },
                              "cid": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived upload credential. Send exact bytes to this URL with the returned method and contentType; no OAuth header is required. Present only in the response of the command that issued it (ingestions.start, ingestions.attach_original, ingestions.reissue_upload); replays and reads omit it, so call ingestions.reissue_upload for a fresh one."
                              },
                              "method": {
                                "const": "PUT",
                                "description": "Present when this response issued the upload URL."
                              }
                            },
                            "required": [
                              "filename",
                              "contentType",
                              "size",
                              "expiresAt",
                              "status"
                            ]
                          }
                        }
                      },
                      "revisions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "startedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "business": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "legalName": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "name",
                                "legalName"
                              ]
                            },
                            "completedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "status": {
                              "enum": [
                                "processing",
                                "completed",
                                "failed"
                              ]
                            },
                            "sources": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "documentId": {
                                    "type": "string"
                                  },
                                  "cid": {
                                    "type": "string"
                                  },
                                  "format": {
                                    "enum": [
                                      "markdown",
                                      "text",
                                      "document"
                                    ]
                                  },
                                  "provenance": {
                                    "enum": [
                                      "caller_supplied_unverified",
                                      "registered_bytes"
                                    ]
                                  },
                                  "role": {
                                    "enum": [
                                      "primary",
                                      "original"
                                    ]
                                  }
                                },
                                "required": [
                                  "documentId",
                                  "cid",
                                  "format",
                                  "provenance",
                                  "role"
                                ]
                              }
                            },
                            "failure": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "reason": {
                                  "type": "string"
                                },
                                "retryable": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "reason",
                                "retryable"
                              ]
                            },
                            "invoiceSelection": {
                              "type": "object",
                              "additionalProperties": false,
                              "description": "Observed source-span choices, bound to the committed UTF-8 extraction. Spans versions pick candidate indices; fields versions carry verified UTF-8 spans for header and payment-identity values. Choice probability is not financial accuracy or authorization.",
                              "properties": {
                                "textCid": {
                                  "type": "string"
                                },
                                "promptVersion": {
                                  "enum": [
                                    "invoice-fields-v5",
                                    "receipt-fields-v5",
                                    "invoice-spans-v1",
                                    "receipt-spans-v1",
                                    "invoice-fields-v1",
                                    "receipt-fields-v1",
                                    "invoice-fields-v2",
                                    "receipt-fields-v2",
                                    "invoice-fields-v3",
                                    "receipt-fields-v3",
                                    "invoice-fields-v4",
                                    "receipt-fields-v4"
                                  ]
                                },
                                "headers": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "vendor": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "buyer": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "externalId": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "date": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "currency": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "total": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "vendor",
                                    "buyer",
                                    "externalId",
                                    "date",
                                    "currency",
                                    "total"
                                  ]
                                },
                                "provider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "The model that chose header values and optional source-line amounts: Clef for spans versions, Clairic for fields versions.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/cloudflare/clef-flash",
                                        "@cf/cloudflare/clef",
                                        "@cf/cloudflare/clairic"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "judgmentProvider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "Fields versions only: the Clef model or bounded Flash-to-Clef cascade that answered currency, service, payment status and row judgments. Optional Clairic amount reads are accounted in provider.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/cloudflare/clef-flash",
                                        "@cf/cloudflare/clef",
                                        "@cf/cloudflare/clef-flash+clef/uncertain-groups-v1"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "groupingProvider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "description": "Measured optional grouping attempt, including a failed attempt that retains physical rows.",
                                  "properties": {
                                    "name": {
                                      "enum": [
                                        "@cf/moonshotai/kimi-k2.6"
                                      ]
                                    },
                                    "version": {
                                      "const": "unreported"
                                    },
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version",
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                },
                                "rowGroups": {
                                  "type": "array",
                                  "maxItems": 1024,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "firstRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "lastRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "anchorRow": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1023
                                      },
                                      "description": {
                                        "type": "object",
                                        "properties": {
                                          "start": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 65536
                                          },
                                          "end": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 65536
                                          },
                                          "text": {
                                            "type": "string",
                                            "maxLength": 65536
                                          }
                                        },
                                        "required": [
                                          "start",
                                          "end",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "firstRow",
                                      "lastRow",
                                      "anchorRow"
                                    ]
                                  }
                                },
                                "service": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "choice": {
                                      "type": "string",
                                      "maxLength": 32
                                    },
                                    "probability": {
                                      "type": "string",
                                      "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                    },
                                    "span": {
                                      "type": "object",
                                      "properties": {
                                        "start": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 65536
                                        },
                                        "end": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 65536
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 65536
                                        }
                                      },
                                      "required": [
                                        "start",
                                        "end",
                                        "text"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "choice",
                                    "probability"
                                  ]
                                },
                                "payment": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "status": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "externalId": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    },
                                    "last4": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "choice": {
                                          "type": "string",
                                          "maxLength": 32
                                        },
                                        "probability": {
                                          "type": "string",
                                          "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                        },
                                        "span": {
                                          "type": "object",
                                          "properties": {
                                            "start": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "end": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 65536
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 65536
                                            }
                                          },
                                          "required": [
                                            "start",
                                            "end",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "choice",
                                        "probability"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "status",
                                    "externalId",
                                    "last4"
                                  ]
                                },
                                "rows": {
                                  "type": "array",
                                  "maxItems": 1024,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "role": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "choice": {
                                            "type": "string",
                                            "maxLength": 32
                                          },
                                          "probability": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                          },
                                          "span": {
                                            "type": "object",
                                            "properties": {
                                              "start": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "end": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "text": {
                                                "type": "string",
                                                "maxLength": 65536
                                              }
                                            },
                                            "required": [
                                              "start",
                                              "end",
                                              "text"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "choice",
                                          "probability"
                                        ]
                                      },
                                      "amount": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                          "choice": {
                                            "type": "string",
                                            "maxLength": 32
                                          },
                                          "probability": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.[0-9]{1,15})?|1(?:\\.0{1,15})?)$"
                                          },
                                          "span": {
                                            "type": "object",
                                            "properties": {
                                              "start": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "end": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 65536
                                              },
                                              "text": {
                                                "type": "string",
                                                "maxLength": 65536
                                              }
                                            },
                                            "required": [
                                              "start",
                                              "end",
                                              "text"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "choice",
                                          "probability"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "role",
                                      "amount"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "textCid",
                                "promptVersion",
                                "headers",
                                "service",
                                "rows"
                              ]
                            },
                            "extraction": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "status": {
                                  "enum": [
                                    "not_required",
                                    "extracted",
                                    "incomplete"
                                  ]
                                },
                                "method": {
                                  "enum": [
                                    "provided_text",
                                    "native_pdf",
                                    "image_ocr",
                                    "pdf_ocr"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 65536,
                                  "description": "Returned only after source-document authorization; raw history contains annex references."
                                },
                                "textBytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 65536
                                },
                                "source": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "documentId": {
                                      "type": "string"
                                    },
                                    "cid": {
                                      "type": "string"
                                    },
                                    "format": {
                                      "enum": [
                                        "markdown",
                                        "text",
                                        "document"
                                      ]
                                    },
                                    "provenance": {
                                      "enum": [
                                        "caller_supplied_unverified",
                                        "registered_bytes"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "documentId",
                                    "cid",
                                    "format",
                                    "provenance"
                                  ]
                                },
                                "derived": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "cid": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "cid"
                                  ]
                                },
                                "pageCount": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ],
                                  "minimum": 1,
                                  "maximum": 50
                                },
                                "locations": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                      "page": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ],
                                        "minimum": 1
                                      },
                                      "start": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "end": {
                                        "type": "integer",
                                        "minimum": 0
                                      }
                                    },
                                    "required": [
                                      "page",
                                      "start",
                                      "end"
                                    ]
                                  }
                                },
                                "provider": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "name": {
                                      "type": "string"
                                    },
                                    "version": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "version"
                                  ]
                                },
                                "usage": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "conversionTokens": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "description": "Estimated native conversion tokens, distinct from inference usage."
                                    }
                                  },
                                  "required": [
                                    "inputTokens",
                                    "outputTokens",
                                    "latencyMs"
                                  ]
                                }
                              },
                              "required": [
                                "status",
                                "method",
                                "textBytes",
                                "source",
                                "derived",
                                "pageCount",
                                "locations",
                                "provider",
                                "usage"
                              ]
                            },
                            "classification": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "documentType": {
                                  "enum": [
                                    "invoice",
                                    "receipt",
                                    "agreement",
                                    "statement_or_remittance",
                                    "credit_or_correction",
                                    "reminder",
                                    "mixed",
                                    "other",
                                    "uncertain"
                                  ]
                                },
                                "probabilities": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "invoice": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "receipt": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "agreement": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "statement_or_remittance": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "credit_or_correction": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "reminder": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "mixed": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "other": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    },
                                    "uncertain": {
                                      "type": "string",
                                      "description": "Decimal probability between 0 and 1."
                                    }
                                  },
                                  "required": [
                                    "invoice",
                                    "receipt",
                                    "agreement",
                                    "statement_or_remittance",
                                    "credit_or_correction",
                                    "reminder",
                                    "mixed",
                                    "other",
                                    "uncertain"
                                  ]
                                },
                                "model": {
                                  "type": "string"
                                },
                                "modelVersion": {
                                  "type": "string"
                                },
                                "promptVersion": {
                                  "type": "string"
                                },
                                "confidence": {
                                  "type": "string",
                                  "description": "Distribution confidence, not calibrated accuracy or permission to act."
                                },
                                "invoiceRole": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "role": {
                                      "enum": [
                                        "buyer",
                                        "seller",
                                        "neither",
                                        "unclear"
                                      ]
                                    },
                                    "probabilities": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "properties": {
                                        "buyer": {
                                          "type": "string"
                                        },
                                        "seller": {
                                          "type": "string"
                                        },
                                        "neither": {
                                          "type": "string"
                                        },
                                        "unclear": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "buyer",
                                        "seller",
                                        "neither",
                                        "unclear"
                                      ]
                                    },
                                    "confidence": {
                                      "type": "string"
                                    },
                                    "promptVersion": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "probabilities",
                                    "confidence",
                                    "promptVersion"
                                  ]
                                },
                                "usage": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "inputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "outputTokens": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "requestBytes": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "latencyMs": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "inputTokens",
                                    "outputTokens",
                                    "requestBytes",
                                    "latencyMs"
                                  ]
                                }
                              },
                              "required": [
                                "documentType",
                                "probabilities",
                                "model",
                                "modelVersion",
                                "promptVersion"
                              ]
                            }
                          },
                          "required": [
                            "revision",
                            "startedAt",
                            "business",
                            "status",
                            "sources"
                          ]
                        }
                      }
                    },
                    "required": [
                      "ingestionId",
                      "createdAt",
                      "status",
                      "uploads",
                      "revisions"
                    ],
                    "x-relative-urls": [
                      "/uploads/primary/url",
                      "/uploads/original/url"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "disposition": {
                        "enum": [
                          "review",
                          "needs_information"
                        ]
                      },
                      "missing": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "source": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "textCid": {
                            "type": "string"
                          },
                          "provenance": {
                            "enum": [
                              "registered_bytes",
                              "caller_supplied_unverified"
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "cid",
                          "textCid",
                          "provenance"
                        ]
                      },
                      "currency": {
                        "type": "string"
                      },
                      "decimals": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 18
                      },
                      "totals": {
                        "type": "object",
                        "properties": {
                          "in": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                          },
                          "out": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                          }
                        },
                        "required": [
                          "in",
                          "out"
                        ]
                      },
                      "rows": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "object",
                          "properties": {
                            "index": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 499
                            },
                            "sourcePointer": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "date": {
                              "type": "string",
                              "format": "date"
                            },
                            "direction": {
                              "enum": [
                                "in",
                                "out"
                              ]
                            },
                            "amountMinor": {
                              "type": "string",
                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                            },
                            "party": {
                              "type": "string"
                            },
                            "reference": {
                              "type": "string"
                            },
                            "disposition": {
                              "enum": [
                                "matched",
                                "unmatched",
                                "ambiguous",
                                "needs_information"
                              ]
                            },
                            "candidateCount": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 0
                            },
                            "candidatesTruncated": {
                              "type": "boolean"
                            },
                            "candidates": {
                              "type": "array",
                              "maxItems": 20,
                              "items": {
                                "type": "object",
                                "properties": {
                                  "claimId": {
                                    "type": "string"
                                  },
                                  "component": {
                                    "type": "object",
                                    "properties": {
                                      "originLedgerId": {
                                        "type": "string"
                                      },
                                      "accountCode": {
                                        "type": "integer"
                                      }
                                    },
                                    "required": [
                                      "originLedgerId",
                                      "accountCode"
                                    ]
                                  },
                                  "partyId": {
                                    "type": "string"
                                  },
                                  "original": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                  },
                                  "outstanding": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                  },
                                  "status": {
                                    "enum": [
                                      "open",
                                      "settled",
                                      "converted",
                                      "cancelled"
                                    ]
                                  },
                                  "sourceFactId": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "claimId",
                                  "component",
                                  "partyId",
                                  "original",
                                  "outstanding",
                                  "status",
                                  "sourceFactId"
                                ]
                              }
                            }
                          },
                          "required": [
                            "index",
                            "sourcePointer",
                            "id",
                            "date",
                            "direction",
                            "amountMinor",
                            "party",
                            "disposition",
                            "candidateCount",
                            "candidatesTruncated",
                            "candidates"
                          ]
                        }
                      }
                    },
                    "required": [
                      "disposition",
                      "missing",
                      "source",
                      "rows"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "eventId"
                    ],
                    "properties": {
                      "eventId": {
                        "type": "integer"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "eventId"
                    ],
                    "properties": {
                      "eventId": {
                        "type": "integer"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "principalId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "role": {
                        "enum": [
                          "owner",
                          "member"
                        ]
                      }
                    },
                    "required": [
                      "principalId",
                      "role"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "principalId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "principalId"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "messageId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "direction": {
                        "enum": [
                          "outbound"
                        ]
                      },
                      "status": {
                        "enum": [
                          "sent"
                        ]
                      },
                      "to": {
                        "type": "string",
                        "minLength": 1
                      },
                      "toName": {
                        "type": "string"
                      },
                      "relationship": {
                        "type": "object",
                        "properties": {
                          "contractId": {
                            "type": "string"
                          },
                          "agreementId": {
                            "type": "string"
                          },
                          "connectionId": {
                            "type": "string"
                          },
                          "demo": {
                            "const": true
                          }
                        }
                      },
                      "topic": {
                        "enum": [
                          "support",
                          "feature_suggestion",
                          "general"
                        ]
                      },
                      "subject": {
                        "type": "string"
                      },
                      "body": {
                        "type": "string"
                      },
                      "context": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "about": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "cid": {
                              "type": "string"
                            },
                            "kind": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "documentId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "cid",
                            "kind"
                          ]
                        }
                      },
                      "inReplyTo": {
                        "type": "object",
                        "properties": {
                          "messageId": {
                            "type": "string"
                          },
                          "sourceMessageId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "messageId",
                          "sourceMessageId"
                        ]
                      },
                      "sentAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "messageId",
                      "direction",
                      "status",
                      "toName",
                      "relationship",
                      "topic",
                      "subject",
                      "body",
                      "sentAt"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "revision": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "id",
                      "revision"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "revision": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "id",
                      "revision"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "revision": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "id",
                      "revision"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "revision": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "id",
                      "revision"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "contactId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "partyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "email": {
                        "type": "string",
                        "format": "email",
                        "maxLength": 254
                      },
                      "role": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "contactId",
                      "partyId",
                      "name",
                      "email"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "vendorCatalog": {
                        "type": "string",
                        "minLength": 1
                      },
                      "vendorCatalogs": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "vendorCatalogsTruncated": {
                        "const": true
                      },
                      "partyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "legalName": {
                        "type": "string"
                      },
                      "relatedParty": {
                        "type": "boolean",
                        "description": "Current, explicitly supplied relationship to this business; independent of customer/vendor roles."
                      },
                      "url": {
                        "type": "string"
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri"
                      },
                      "logoCid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "logoOrigin": {
                        "type": "object",
                        "description": "Who chose the logo: `business`, or `catalog` with the vendor and catalog entry version contracts.adopt read."
                      },
                      "iri": {
                        "type": "string",
                        "minLength": 1
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "enum": [
                            "customer",
                            "vendor",
                            "founder",
                            "investor",
                            "provider",
                            "employee"
                          ]
                        }
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "contacts": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      },
                      "address": {
                        "type": "object"
                      }
                    },
                    "required": [
                      "partyId",
                      "iri",
                      "name",
                      "categories",
                      "archived",
                      "contacts"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "vendorCatalog": {
                        "type": "string",
                        "minLength": 1
                      },
                      "vendorCatalogs": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "vendorCatalogsTruncated": {
                        "const": true
                      },
                      "partyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "legalName": {
                        "type": "string"
                      },
                      "relatedParty": {
                        "type": "boolean",
                        "description": "Current, explicitly supplied relationship to this business; independent of customer/vendor roles."
                      },
                      "url": {
                        "type": "string"
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri"
                      },
                      "logoCid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "logoOrigin": {
                        "type": "object",
                        "description": "Who chose the logo: `business`, or `catalog` with the vendor and catalog entry version contracts.adopt read."
                      },
                      "iri": {
                        "type": "string",
                        "minLength": 1
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "enum": [
                            "customer",
                            "vendor",
                            "founder",
                            "investor",
                            "provider",
                            "employee"
                          ]
                        }
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "contacts": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      },
                      "address": {
                        "type": "object"
                      }
                    },
                    "required": [
                      "partyId",
                      "iri",
                      "name",
                      "categories",
                      "archived",
                      "contacts"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "vendorCatalog": {
                        "type": "string",
                        "minLength": 1
                      },
                      "expectedPartyId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "partyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "pattern": "\\S",
                        "maxLength": 2000
                      }
                    },
                    "required": [
                      "vendorCatalog",
                      "expectedPartyId",
                      "partyId",
                      "reason"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "vendorCatalog": {
                        "type": "string",
                        "minLength": 1
                      },
                      "vendorCatalogs": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "vendorCatalogsTruncated": {
                        "const": true
                      },
                      "partyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "legalName": {
                        "type": "string"
                      },
                      "relatedParty": {
                        "type": "boolean",
                        "description": "Current, explicitly supplied relationship to this business; independent of customer/vendor roles."
                      },
                      "url": {
                        "type": "string"
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri"
                      },
                      "logoCid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "logoOrigin": {
                        "type": "object",
                        "description": "Who chose the logo: `business`, or `catalog` with the vendor and catalog entry version contracts.adopt read."
                      },
                      "iri": {
                        "type": "string",
                        "minLength": 1
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "enum": [
                            "customer",
                            "vendor",
                            "founder",
                            "investor",
                            "provider",
                            "employee"
                          ]
                        }
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "contacts": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      },
                      "address": {
                        "type": "object"
                      }
                    },
                    "required": [
                      "partyId",
                      "iri",
                      "name",
                      "categories",
                      "archived",
                      "contacts"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "vendorCatalog": {
                        "type": "string",
                        "minLength": 1
                      },
                      "vendorCatalogs": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "vendorCatalogsTruncated": {
                        "const": true
                      },
                      "partyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "legalName": {
                        "type": "string"
                      },
                      "relatedParty": {
                        "type": "boolean",
                        "description": "Current, explicitly supplied relationship to this business; independent of customer/vendor roles."
                      },
                      "url": {
                        "type": "string"
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri"
                      },
                      "logoCid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "logoOrigin": {
                        "type": "object",
                        "description": "Who chose the logo: `business`, or `catalog` with the vendor and catalog entry version contracts.adopt read."
                      },
                      "iri": {
                        "type": "string",
                        "minLength": 1
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "enum": [
                            "customer",
                            "vendor",
                            "founder",
                            "investor",
                            "provider",
                            "employee"
                          ]
                        }
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "contacts": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      },
                      "address": {
                        "type": "object"
                      }
                    },
                    "required": [
                      "partyId",
                      "iri",
                      "name",
                      "categories",
                      "archived",
                      "contacts"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "vendorCatalog": {
                        "type": "string",
                        "minLength": 1
                      },
                      "vendorCatalogs": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "vendorCatalogsTruncated": {
                        "const": true
                      },
                      "partyId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "legalName": {
                        "type": "string"
                      },
                      "relatedParty": {
                        "type": "boolean",
                        "description": "Current, explicitly supplied relationship to this business; independent of customer/vendor roles."
                      },
                      "url": {
                        "type": "string"
                      },
                      "logoUrl": {
                        "type": "string",
                        "format": "uri"
                      },
                      "logoCid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "logoOrigin": {
                        "type": "object",
                        "description": "Who chose the logo: `business`, or `catalog` with the vendor and catalog entry version contracts.adopt read."
                      },
                      "iri": {
                        "type": "string",
                        "minLength": 1
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "enum": [
                            "customer",
                            "vendor",
                            "founder",
                            "investor",
                            "provider",
                            "employee"
                          ]
                        }
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "contacts": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      },
                      "address": {
                        "type": "object"
                      }
                    },
                    "required": [
                      "partyId",
                      "iri",
                      "name",
                      "categories",
                      "archived",
                      "contacts"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "allocationId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "paymentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "remaining": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "allocationId",
                      "paymentId",
                      "remaining"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "payment",
                      "grossAmount",
                      "netAmount",
                      "fee"
                    ],
                    "properties": {
                      "payment": {
                        "type": "object"
                      },
                      "grossAmount": {
                        "type": "string"
                      },
                      "netAmount": {
                        "type": "string"
                      },
                      "fee": {
                        "type": "object"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "paymentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "currency": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The currency the payment was recorded in: a personal account's own, when a payment stated in a foreign bill's currency was converted at its booking rate."
                      },
                      "amount": {
                        "type": "string",
                        "description": "The amount recorded, in `currency`."
                      },
                      "residual": {
                        "type": "string"
                      },
                      "recoverableClaim": {
                        "type": "object",
                        "properties": {
                          "claimId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "component": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "originLedgerId",
                              "accountCode"
                            ],
                            "properties": {
                              "originLedgerId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "accountCode": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "required": [
                          "claimId",
                          "component"
                        ]
                      },
                      "unappliedClaim": {
                        "type": "object",
                        "properties": {
                          "claimId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "component": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "originLedgerId",
                              "accountCode"
                            ],
                            "properties": {
                              "originLedgerId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "accountCode": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "required": [
                          "claimId",
                          "component"
                        ]
                      },
                      "fundingClaims": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "claimId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "component": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "originLedgerId",
                                "accountCode"
                              ],
                              "properties": {
                                "originLedgerId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "accountCode": {
                                  "type": "integer"
                                }
                              }
                            }
                          },
                          "required": [
                            "claimId",
                            "component"
                          ]
                        }
                      }
                    },
                    "required": [
                      "paymentId",
                      "residual",
                      "fundingClaims"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "paymentId",
                      "reversalId"
                    ],
                    "properties": {
                      "paymentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "reversalId": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "paymentId"
                    ],
                    "properties": {
                      "paymentId": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "unallocationId",
                      "paymentId",
                      "amount"
                    ],
                    "properties": {
                      "unallocationId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "paymentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "amount": {
                        "type": "string"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "eventId"
                    ],
                    "properties": {
                      "eventId": {
                        "type": "integer"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "economic",
                      "payment"
                    ],
                    "properties": {
                      "economic": {
                        "type": "object"
                      },
                      "payment": {
                        "type": "object"
                      },
                      "processing": {
                        "type": "object"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                      },
                      "version": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "reportSchema": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "documentId": {
                        "type": "string"
                      },
                      "cid": {
                        "type": "string"
                      },
                      "status": {
                        "enum": [
                          "published",
                          "archived"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "version",
                      "reportSchema",
                      "title",
                      "description",
                      "documentId",
                      "cid",
                      "status"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "pins": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                            },
                            "overview": {
                              "type": "boolean"
                            },
                            "title": {
                              "type": "string"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1
                            }
                          },
                          "required": [
                            "id",
                            "overview",
                            "title",
                            "version"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "pins"
                    ],
                    "additionalProperties": false
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                      },
                      "version": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "reportSchema": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "documentId": {
                        "type": "string"
                      },
                      "cid": {
                        "type": "string"
                      },
                      "status": {
                        "enum": [
                          "published",
                          "archived"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "version",
                      "reportSchema",
                      "title",
                      "description",
                      "documentId",
                      "cid",
                      "status"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "pins": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                            },
                            "overview": {
                              "type": "boolean"
                            },
                            "title": {
                              "type": "string"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1
                            }
                          },
                          "required": [
                            "id",
                            "overview",
                            "title",
                            "version"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "pins"
                    ],
                    "additionalProperties": false
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "eventId"
                    ],
                    "properties": {
                      "eventId": {
                        "type": "integer"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "eventId"
                    ],
                    "properties": {
                      "eventId": {
                        "type": "integer"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "required": [
                      "packageId",
                      "jurisdiction",
                      "legalEntityScope",
                      "framework",
                      "frameworkEdition",
                      "policyElections",
                      "overrides",
                      "evidenceDocumentId",
                      "evidenceDocumentCid"
                    ],
                    "properties": {
                      "packageId": {
                        "type": "string"
                      },
                      "jurisdiction": {
                        "type": "string"
                      },
                      "legalEntityScope": {
                        "type": "string"
                      },
                      "framework": {
                        "type": "string"
                      },
                      "frameworkEdition": {
                        "type": "string"
                      },
                      "policyElections": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "overrideSetCid": {
                        "type": "string"
                      },
                      "overrides": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "ruleId",
                            "destination"
                          ],
                          "properties": {
                            "ruleId": {
                              "type": "string"
                            },
                            "destination": {
                              "type": "object",
                              "required": [
                                "code",
                                "label",
                                "reportLineIds"
                              ],
                              "properties": {
                                "code": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "reportLineIds": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 32,
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "evidenceDocumentId": {
                        "type": "string"
                      },
                      "evidenceDocumentCid": {
                        "type": "string"
                      }
                    }
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "viewId": {
                        "type": "string"
                      },
                      "token": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "reports": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uniqueItems": true
                      },
                      "documents": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uniqueItems": true
                      },
                      "contracts": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uniqueItems": true
                      },
                      "currency": {
                        "type": "string"
                      },
                      "expiresAt": {
                        "type": "string"
                      },
                      "mode": {
                        "enum": [
                          "live",
                          "frozen"
                        ]
                      },
                      "definitions": {
                        "type": "array",
                        "maxItems": 12,
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "snapshotCid": {
                              "type": "string"
                            },
                            "snapshotDocumentId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "version"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "capturedAt": {
                        "type": "string"
                      },
                      "createdEventId": {
                        "type": "integer"
                      },
                      "revokedEventId": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "viewId",
                      "token",
                      "description",
                      "reports",
                      "documents",
                      "contracts",
                      "currency"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "viewId": {
                        "type": "string"
                      },
                      "token": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "reports": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uniqueItems": true
                      },
                      "documents": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uniqueItems": true
                      },
                      "contracts": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uniqueItems": true
                      },
                      "currency": {
                        "type": "string"
                      },
                      "expiresAt": {
                        "type": "string"
                      },
                      "mode": {
                        "enum": [
                          "live",
                          "frozen"
                        ]
                      },
                      "definitions": {
                        "type": "array",
                        "maxItems": 12,
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "snapshotCid": {
                              "type": "string"
                            },
                            "snapshotDocumentId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "version"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "capturedAt": {
                        "type": "string"
                      },
                      "createdEventId": {
                        "type": "integer"
                      },
                      "revokedEventId": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "viewId",
                      "token",
                      "description",
                      "reports",
                      "documents",
                      "contracts",
                      "currency"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "cancellationId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "status": {
                        "enum": [
                          "pending",
                          "scheduled",
                          "revoked",
                          "expired",
                          "completed"
                        ]
                      },
                      "requestedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "requestedBy": {
                        "type": "string"
                      },
                      "reason": {
                        "type": "string"
                      },
                      "expiresAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "effectiveAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "approvedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "approvedBy": {
                        "type": "string"
                      },
                      "closedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "closedBy": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "cancellationId",
                      "status",
                      "requestedAt",
                      "expiresAt"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "cancellationId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "status": {
                        "enum": [
                          "pending",
                          "scheduled",
                          "revoked",
                          "expired",
                          "completed"
                        ]
                      },
                      "requestedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "requestedBy": {
                        "type": "string"
                      },
                      "reason": {
                        "type": "string"
                      },
                      "expiresAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "effectiveAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "approvedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "approvedBy": {
                        "type": "string"
                      },
                      "closedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "closedBy": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "cancellationId",
                      "status",
                      "requestedAt",
                      "expiresAt"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "taxCodeId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "code": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "role": {
                        "enum": [
                          "output",
                          "input",
                          "reverse_charge",
                          "imported_services",
                          "non_recoverable"
                        ],
                        "default": "output",
                        "description": "How the code posts: output credits 2160; input debits recoverable 1170; reverse_charge and imported_services debit 1170 and credit 2165; non_recoverable tax is added to the expense."
                      },
                      "ratePpm": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000,
                        "description": "Rate in parts per million: 50000 means 5%, 99750 means 9.975%."
                      },
                      "effectiveFrom": {
                        "type": "string",
                        "format": "date",
                        "description": "First day the rate applies; omit for no lower bound."
                      },
                      "effectiveUntil": {
                        "type": "string",
                        "format": "date",
                        "description": "First day the rate no longer applies (exclusive); omit for open-ended."
                      },
                      "regime": {
                        "type": "string",
                        "description": "The sales-tax registration regime that seeded this code, if any."
                      },
                      "liabilityAccountCode": {
                        "type": "integer"
                      },
                      "recoverable": {
                        "type": "boolean"
                      },
                      "active": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "taxCodeId",
                      "code",
                      "name",
                      "role",
                      "ratePpm",
                      "active"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "taxCodeId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "code": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "role": {
                        "enum": [
                          "output",
                          "input",
                          "reverse_charge",
                          "imported_services",
                          "non_recoverable"
                        ],
                        "default": "output",
                        "description": "How the code posts: output credits 2160; input debits recoverable 1170; reverse_charge and imported_services debit 1170 and credit 2165; non_recoverable tax is added to the expense."
                      },
                      "ratePpm": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000,
                        "description": "Rate in parts per million: 50000 means 5%, 99750 means 9.975%."
                      },
                      "effectiveFrom": {
                        "type": "string",
                        "format": "date",
                        "description": "First day the rate applies; omit for no lower bound."
                      },
                      "effectiveUntil": {
                        "type": "string",
                        "format": "date",
                        "description": "First day the rate no longer applies (exclusive); omit for open-ended."
                      },
                      "regime": {
                        "type": "string",
                        "description": "The sales-tax registration regime that seeded this code, if any."
                      },
                      "liabilityAccountCode": {
                        "type": "integer"
                      },
                      "recoverable": {
                        "type": "boolean"
                      },
                      "active": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "taxCodeId",
                      "code",
                      "name",
                      "role",
                      "ratePpm",
                      "active"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "id"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "id",
                      "documentId",
                      "cid"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "id",
                      "documentId",
                      "cid"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "const": "no_change"
                  },
                  "message": {
                    "type": "string"
                  },
                  "hint": {
                    "type": "string"
                  },
                  "details": {}
                }
              }
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/commands/{id}

Operation: commands.get


```json
{
  "operationId": "commands.get",
  "description": "Retrieve an accepted receipt without executing a command.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {
            "anyOf": [
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {},
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/documents

Operation: documents.list


```json
{
  "operationId": "documents.list",
  "description": "Read immutable document metadata and exact bytes. Every row carries label (the founder word: Invoice, Bill, Payment receipt, Charge, Plan, Contract, …) and title; a statement also carries counterpartyId and, when its first effect is money, its headline amount (integer minor units) and currency. An activity, template or contract version also carries record, the type and id of the record it is a version of. Relations rows carry fromLabel, fromTitle, toLabel and toTitle (null when that document is missing). Get requires id and returns contentBase64; a source_document or image also carries size, its exact registered byte count. List supports kind, external_id, label and ids filters with an exclusive document-ID after cursor; ids takes 1–500 document ids and returns those the book holds, in id order (a repeat counts once). Label takes a record type's founder word (Invoice, Payment receipt, Bill, Bill payment, Refund, Credit note, Cancellation or Activity statement) and refuses any other word, so filter catalog documents by kind. Relations requires id and pages by the exclusive numeric after_id relation cursor.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "external_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "label",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## POST /v1/documents

Operation: documents.submit


```json
{
  "operationId": "documents.submit",
  "description": "Register an immutable artifact via documents.receive. Same idempotency and receipts as commands.execute; omit name. Native upload uses multipart/form-data with metadata (the JSON envelope without input.contentBase64) and file (exact bytes).",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "input": {
              "type": "object",
              "properties": {
                "kind": {
                  "enum": [
                    "source_document",
                    "activity",
                    "template",
                    "contract",
                    "activity_statement",
                    "contract_lifecycle_statement",
                    "image"
                  ]
                },
                "contentBase64": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 13981016,
                  "pattern": "^[A-Za-z0-9+/]+={0,2}$",
                  "description": "The exact artifact bytes encoded as base64: at most 10485760 bytes for a source_document, 262144 bytes for the structured kinds."
                },
                "externalId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200,
                  "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$",
                  "description": "What the document is called, in the founder's words. Omit to take it from the content."
                }
              },
              "required": [
                "kind",
                "contentBase64"
              ],
              "additionalProperties": false
            },
            "idempotency_key": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "effective_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          "required": [
            "input",
            "idempotency_key",
            "effective_at"
          ],
          "additionalProperties": false
        }
      },
      "multipart/form-data": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "metadata",
            "file"
          ],
          "properties": {
            "metadata": {
              "type": "string",
              "maxLength": 65536,
              "contentMediaType": "application/json",
              "description": "JSON command envelope, omitting name and input.contentBase64."
            },
            "file": {
              "type": "string",
              "format": "binary",
              "x-max-bytes": 10485760,
              "description": "Exact artifact bytes. Each document kind retains its existing size limit."
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {
            "anyOf": [
              {
                "type": "object",
                "required": [
                  "commandId",
                  "replayed",
                  "result",
                  "events"
                ],
                "properties": {
                  "commandId": {
                    "type": "string"
                  },
                  "replayed": {
                    "type": "boolean"
                  },
                  "imported": {
                    "const": true,
                    "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "documentId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cid": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "documentId",
                      "cid"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "cid": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "const": "no_change"
                  },
                  "message": {
                    "type": "string"
                  },
                  "hint": {
                    "type": "string"
                  },
                  "details": {}
                }
              }
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a multipart upload, or a JSON body larger than 256 KiB, must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Upload body or file exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Use application/json or multipart/form-data.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/events

Operation: events.list


```json
{
  "operationId": "events.list",
  "description": "Read event history and provenance. Every row carries commandName and the documents the event produced, each with its founder label (Invoice, Bill, Contract, …); a document.related row also carries relatedDocuments, the from and to documents its payload relates, each with id, kind, label and title (null when that document is missing). List is oldest first and pages by an exclusive numeric after cursor; with order desc it is newest first and pages by an exclusive numeric before cursor instead. Get requires id. List accepts footprint_contract_id to select only events with postings attributed to that contract by the ledger footprint, including independent payment allocations and reversals, under events.read authority. claim_contract_id instead selects only the events that posted to one of that contract's claims (its bills, invoices and refunds, and the payments, allocations, unallocations and reversals against them), found on the claim index, driven from the contract's claims to each event by id, so a page costs the contract's own postings, never the rest of the book's history; a contract that does not exist selects no events. payment_direction (in or out) selects only the payment.recorded events of payments in that direction that no reversal took back, on an index of payments by direction, so a page costs the page, never the book's history. A subject_id filter also needs its subject_type. kind_prefix narrows to event kinds in one or more namespaces, comma-separated (party.,party_contact.), which selects the business, document, party and financial-account events that carry no subject. Payload amounts are integer strings. An ingestion.* payload omits the delegation captured at intake (authority) and each upload's tokenHash, as the ingestions read does. No verification sweep is triggered.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "before",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "order",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "asc",
          "desc"
        ]
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "subject_type",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "subject_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "kind_prefix",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "footprint_contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "claim_contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "payment_direction",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "in",
          "out"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/events/head

Operation: events.head


```json
{
  "operationId": "events.head",
  "description": "Read event history and provenance. Every row carries commandName and the documents the event produced, each with its founder label (Invoice, Bill, Contract, …); a document.related row also carries relatedDocuments, the from and to documents its payload relates, each with id, kind, label and title (null when that document is missing). List is oldest first and pages by an exclusive numeric after cursor; with order desc it is newest first and pages by an exclusive numeric before cursor instead. Get requires id. List accepts footprint_contract_id to select only events with postings attributed to that contract by the ledger footprint, including independent payment allocations and reversals, under events.read authority. claim_contract_id instead selects only the events that posted to one of that contract's claims (its bills, invoices and refunds, and the payments, allocations, unallocations and reversals against them), found on the claim index, driven from the contract's claims to each event by id, so a page costs the contract's own postings, never the rest of the book's history; a contract that does not exist selects no events. payment_direction (in or out) selects only the payment.recorded events of payments in that direction that no reversal took back, on an index of payments by direction, so a page costs the page, never the book's history. A subject_id filter also needs its subject_type. kind_prefix narrows to event kinds in one or more namespaces, comma-separated (party.,party_contact.), which selects the business, document, party and financial-account events that carry no subject. Payload amounts are integer strings. An ingestion.* payload omits the delegation captured at intake (authority) and each upload's tokenHash, as the ingestions read does. No verification sweep is triggered.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "before",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "order",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "asc",
          "desc"
        ]
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "subject_type",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "subject_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "kind_prefix",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "footprint_contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "claim_contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "payment_direction",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "in",
          "out"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/subjects

Operation: subjects.types


```json
{
  "operationId": "subjects.types",
  "description": "Read derived lifecycle state. Call types first: it lists every subject type with its statuses and the filters its list accepts. List and get require type; get requires id. List supports status, the type's declared filters (email, code, contract_id, activity_key, document_id, record_type, plan, kind, party_id, activity_document_id, template_document_id), ids (1–500 subject ids of the type, those it holds in id order) and an exclusive subject-ID after cursor; a filter the type does not declare is refused. The contract kind filter accepts customer, vendor, investment or other, derived from its saved roles and rights; it returns busy while bounded historical index catch-up is pending, and requires schema 27. On contracts, party_id lists those naming a party in any role, activity_document_id those binding a right's document version and template_document_id those made from a template or plan document version; each of these two also takes a list of 1–500 versions and matches a contract on any of them, with no other filter; otherwise filters combine. Activity and template rows carry versions, every document the record has been, oldest first. An activity_occurrence's state carries recordType (invoice, payment_receipt, bill, bill_payment, refund, credit_note, cancellation or activity_statement), and record_type filters by it. Types carry a founder label and note; activity, template, contract and activity_occurrence rows carry label and title (an occurrence also counterpartyId and, when its headline effect is money, amount, currency and decimals). An invoice, bill or receipt is titled by its occurrence key; a recording that moved nothing (an acceptance, a delivery) by the name of the activity it ran; correlate on state.occurrenceKey, never on title.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "type",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "effective_at",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    },
    {
      "name": "email",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "activity_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "document_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "record_type",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "plan",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "customer",
          "vendor",
          "investment",
          "other"
        ]
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "activity_document_id",
      "in": "query",
      "required": false,
      "schema": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "minItems": 1,
            "maxItems": 500
          }
        ],
        "description": "One document version, or a list of 1–500 to match a contract on any of them."
      }
    },
    {
      "name": "template_document_id",
      "in": "query",
      "required": false,
      "schema": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "minItems": 1,
            "maxItems": 500
          }
        ],
        "description": "One document version, or a list of 1–500 to match a contract on any of them."
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/ledgers

Operation: ledgers.list


```json
{
  "operationId": "ledgers.list",
  "description": "Read native-unit ledger metadata, balances and posting statements. Get, balances and statement require ledger_id. Balances returns one ledger's per-(account, sub-key) debits, credits and balance in its own unit — the balance read for usage meters, prepaid capacity and share classes as well as currency ledgers; account_code (and, with it, sub_key) narrows it to that account's rows, summed on the account index; an optional as_of limits it to postings up to that point (a YYYY-MM-DD date includes that whole UTC day; a UTC timestamp counts postings before it), sub-keys intact. Statement pages postings by the exclusive numeric after_id cursor and can be narrowed to one account_code and, with it, one sub_key (the statement's own subKey string). List pages by the exclusive string ledger-ID after cursor. Currencies names each currency the business's GAAP ledgers hold real postings in, once, and in ledgers the ledger that holds it now (the open one, else the most recently closed; a functional-currency change or an incorporation succeeds a currency's ledger). A business starts with its selected functional-currency ledger (USD when omitted); other canonical currency ledgers open when a contract first binds them. Amounts remain exact strings and are never summed across units. Transaction requires occurrence_id (an invoice, bill or payment record) and returns every posting of every event that touched its claims (the record itself, the payments, credits and corrections against it, with each correction's reversal), in effective order, each with the record it came from, plus otherClaims: other invoices or bills those events also settled. Footprint takes exactly one of party_id, contract_id or occurrence_id and returns every posting of every recording on that party's contracts, on that contract, or in that record's transaction, in effective order, each attributed to its record (occurrenceId, occurrenceKey), activity, pattern and party the way the activity_balances report attributes it, with its ledger's unit and decimals; plus contracts, the contracts it spans. Null when the party, contract or record does not exist.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "ledger_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "occurrence_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "account_code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "event_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "sub_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/people

Operation: people.list


```json
{
  "operationId": "people.list",
  "description": "Read dated team membership, work arrangements and named service identities. Uses party-read permission, returns no monetary data. as_of defaults to the adapter clock; periods are half-open.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "active",
          "former",
          "all"
        ]
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/people/memberships

Operation: people.memberships


```json
{
  "operationId": "people.memberships",
  "description": "Read dated team membership, work arrangements and named service identities. Uses party-read permission, returns no monetary data. as_of defaults to the adapter clock; periods are half-open.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "person_party_id",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/people/arrangements

Operation: people.arrangements


```json
{
  "operationId": "people.arrangements",
  "description": "Read dated team membership, work arrangements and named service identities. Uses party-read permission, returns no monetary data. as_of defaults to the adapter clock; periods are half-open.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "person_party_id",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/people/identities

Operation: people.identities


```json
{
  "operationId": "people.identities",
  "description": "Read dated team membership, work arrangements and named service identities. Uses party-read permission, returns no monetary data. as_of defaults to the adapter clock; periods are half-open.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "person_party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "vendor_party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "account_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "holder",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/parties

Operation: parties.list


```json
{
  "operationId": "parties.list",
  "description": "Read counterparties and contacts. Get requires id. List uses an exclusive party-ID after cursor and includes archived records; category narrows it to parties playing that role (customer, vendor, founder, investor, provider, employee), and vendor also matches providers; ids (1–500 party ids) narrows it to those, in id order. Categories returns the relationship categories in use.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "category",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/parties/categories

Operation: parties.categories


```json
{
  "operationId": "parties.categories",
  "description": "Read counterparties and contacts. Get requires id. List uses an exclusive party-ID after cursor and includes archived records; category narrows it to parties playing that role (customer, vendor, founder, investor, provider, employee), and vendor also matches providers; ids (1–500 party ids) narrows it to those, in id order. Categories returns the relationship categories in use.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "category",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/accounts

Operation: accounts.list


```json
{
  "operationId": "accounts.list",
  "description": "Read registered financial accounts, their currency, provider, brand color, logo and default status. Get, activity, overview and summary require id. Summary also requires month (YYYY-MM, UTC); summaries takes 1–100 ids and month and returns the same figures in an items array. Both return exact balance and spending integer strings without movements (spent is null for ambiguous manual journals); transfers, funding, card repayments, customer refunds and collected-tax remittances are excluded. Activity returns the account's recent recorded payment effects and provider fees with their exact total. Overview returns what the account's page shows: the GL account it is held on (2135 keyed to the owner for a person's own card, whose balance is what the company owes that person across all their own accounts) and its balance; the latest movements (limit caps them, newest first; count is the total), each signed by the account's normal balance with its counterparty, running balance, counter accounts and, through a settled bill, the expense accounts it landed on; totals by month, counter account, expense account and counterparty; and its payment endpoints with full payto/CAIP-10 URIs and rails. List uses an exclusive financial-account-ID after cursor and includes archived accounts; ids (1–100 account ids) narrows it to those, in id order.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/accounts/summaries

Operation: accounts.summaries


```json
{
  "operationId": "accounts.summaries",
  "description": "Read registered financial accounts, their currency, provider, brand color, logo and default status. Get, activity, overview and summary require id. Summary also requires month (YYYY-MM, UTC); summaries takes 1–100 ids and month and returns the same figures in an items array. Both return exact balance and spending integer strings without movements (spent is null for ambiguous manual journals); transfers, funding, card repayments, customer refunds and collected-tax remittances are excluded. Activity returns the account's recent recorded payment effects and provider fees with their exact total. Overview returns what the account's page shows: the GL account it is held on (2135 keyed to the owner for a person's own card, whose balance is what the company owes that person across all their own accounts) and its balance; the latest movements (limit caps them, newest first; count is the total), each signed by the account's normal balance with its counterparty, running balance, counter accounts and, through a settled bill, the expense accounts it landed on; totals by month, counter account, expense account and counterparty; and its payment endpoints with full payto/CAIP-10 URIs and rails. List uses an exclusive financial-account-ID after cursor and includes archived accounts; ids (1–100 account ids) narrows it to those, in id order.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": true,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 100
      }
    },
    {
      "name": "month",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])$"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/payment_routes/quote

Operation: payment_routes.quote


```json
{
  "operationId": "payment_routes.quote",
  "description": "Quote eligible outbound or inbound payment methods from active payment endpoints and provider-contract fee schedules. Pure read; does not move money. Amount and costs are exact minor-unit strings.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "direction",
      "in": "query",
      "required": true,
      "schema": {
        "enum": [
          "in",
          "out"
        ]
      }
    },
    {
      "name": "amount_minor",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[1-9][0-9]*$"
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "assets",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    {
      "name": "rails",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    {
      "name": "max_eta_seconds",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "optimize",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "cheapest",
          "fastest"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/categories

Operation: categories.list


```json
{
  "operationId": "categories.list",
  "description": "Read revenue categories. Get requires id. List pages by exclusive category-ID cursor.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/tax_codes

Operation: tax_codes.list


```json
{
  "operationId": "tax_codes.list",
  "description": "Read configured tax codes: role (output, input, reverse_charge, imported_services, non_recoverable), rate in parts per million, effective period, the liability it credits and the sales-tax regime that seeded it. Get requires id. List includes inactive codes and pages by exclusive tax-code-ID cursor.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/shared_views

Operation: shared_views.list


```json
{
  "operationId": "shared_views.list",
  "description": "List this business's capability links (shared views): every share ever created, revoked ones included with their revoking event, oldest first, with the token each resolves at /e/{slug}/share/{token} on this server. Pages by the exclusive view-ID after cursor. Create and revoke through the shared_views.create and shared_views.revoke commands.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/business

Operation: business.get


```json
{
  "operationId": "business.get",
  "description": "Read the authenticated business's profile (including its fiscal year end and fiscal-year settings, and its sales-tax registrations in force), preview a fiscal-year change (effective_at, year_end MM-DD): its transition period and the fiscal years that follow; list the sales-tax regimes the business can register for in its country, with each regime's registration-number format and the tax codes registering would seed (sales_tax_regimes); read the platform plan (plan): free (the Solo plan), team (the Startup plan) or system, and, on team, the active Startup contract's id (read its terms through subjects to find a trial end or billing date); or read its Economico plan's event meter (meter): the monthly billing period running now, the billable events recorded in it so far and the allowance, and, while a cancelled plan's usage is closed, allowed: the most events the period permits (its included events, or the end of a started block the cancel billed; the period's total, not what is left); or read the event ledger (event_totals): the business's billable events per UTC day, newest first, a page at a time (after: the cursor); or read its imports (imports): the one-time import allowance (null in Economico's own books), the events imported so far, what remains, and the cutoff: a change dated before it (when the business was created on Economico) is recorded as an import, free of monthly events, while the allowance lasts. Returns null for get if no profile has been recorded. Does not change the business.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/business/fiscal-year-change-preview

Operation: business.fiscal_year_change_preview


```json
{
  "operationId": "business.fiscal_year_change_preview",
  "description": "Read the authenticated business's profile (including its fiscal year end and fiscal-year settings, and its sales-tax registrations in force), preview a fiscal-year change (effective_at, year_end MM-DD): its transition period and the fiscal years that follow; list the sales-tax regimes the business can register for in its country, with each regime's registration-number format and the tax codes registering would seed (sales_tax_regimes); read the platform plan (plan): free (the Solo plan), team (the Startup plan) or system, and, on team, the active Startup contract's id (read its terms through subjects to find a trial end or billing date); or read its Economico plan's event meter (meter): the monthly billing period running now, the billable events recorded in it so far and the allowance, and, while a cancelled plan's usage is closed, allowed: the most events the period permits (its included events, or the end of a started block the cancel billed; the period's total, not what is left); or read the event ledger (event_totals): the business's billable events per UTC day, newest first, a page at a time (after: the cursor); or read its imports (imports): the one-time import allowance (null in Economico's own books), the events imported so far, what remains, and the cutoff: a change dated before it (when the business was created on Economico) is recorded as an import, free of monthly events, while the allowance lasts. Returns null for get if no profile has been recorded. Does not change the business.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "effective_at",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "year_end",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$",
        "description": "Proposed fiscal year end as MM-DD, e.g. 06-30."
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/business/sales-tax-regimes

Operation: business.sales_tax_regimes


```json
{
  "operationId": "business.sales_tax_regimes",
  "description": "Read the authenticated business's profile (including its fiscal year end and fiscal-year settings, and its sales-tax registrations in force), preview a fiscal-year change (effective_at, year_end MM-DD): its transition period and the fiscal years that follow; list the sales-tax regimes the business can register for in its country, with each regime's registration-number format and the tax codes registering would seed (sales_tax_regimes); read the platform plan (plan): free (the Solo plan), team (the Startup plan) or system, and, on team, the active Startup contract's id (read its terms through subjects to find a trial end or billing date); or read its Economico plan's event meter (meter): the monthly billing period running now, the billable events recorded in it so far and the allowance, and, while a cancelled plan's usage is closed, allowed: the most events the period permits (its included events, or the end of a started block the cancel billed; the period's total, not what is left); or read the event ledger (event_totals): the business's billable events per UTC day, newest first, a page at a time (after: the cursor); or read its imports (imports): the one-time import allowance (null in Economico's own books), the events imported so far, what remains, and the cutoff: a change dated before it (when the business was created on Economico) is recorded as an import, free of monthly events, while the allowance lasts. Returns null for get if no profile has been recorded. Does not change the business.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/business/plan

Operation: business.plan


```json
{
  "operationId": "business.plan",
  "description": "Read the authenticated business's profile (including its fiscal year end and fiscal-year settings, and its sales-tax registrations in force), preview a fiscal-year change (effective_at, year_end MM-DD): its transition period and the fiscal years that follow; list the sales-tax regimes the business can register for in its country, with each regime's registration-number format and the tax codes registering would seed (sales_tax_regimes); read the platform plan (plan): free (the Solo plan), team (the Startup plan) or system, and, on team, the active Startup contract's id (read its terms through subjects to find a trial end or billing date); or read its Economico plan's event meter (meter): the monthly billing period running now, the billable events recorded in it so far and the allowance, and, while a cancelled plan's usage is closed, allowed: the most events the period permits (its included events, or the end of a started block the cancel billed; the period's total, not what is left); or read the event ledger (event_totals): the business's billable events per UTC day, newest first, a page at a time (after: the cursor); or read its imports (imports): the one-time import allowance (null in Economico's own books), the events imported so far, what remains, and the cutoff: a change dated before it (when the business was created on Economico) is recorded as an import, free of monthly events, while the allowance lasts. Returns null for get if no profile has been recorded. Does not change the business.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "target_plan",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "enum": [
          "founders"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/business/meter

Operation: business.meter


```json
{
  "operationId": "business.meter",
  "description": "Read the authenticated business's profile (including its fiscal year end and fiscal-year settings, and its sales-tax registrations in force), preview a fiscal-year change (effective_at, year_end MM-DD): its transition period and the fiscal years that follow; list the sales-tax regimes the business can register for in its country, with each regime's registration-number format and the tax codes registering would seed (sales_tax_regimes); read the platform plan (plan): free (the Solo plan), team (the Startup plan) or system, and, on team, the active Startup contract's id (read its terms through subjects to find a trial end or billing date); or read its Economico plan's event meter (meter): the monthly billing period running now, the billable events recorded in it so far and the allowance, and, while a cancelled plan's usage is closed, allowed: the most events the period permits (its included events, or the end of a started block the cancel billed; the period's total, not what is left); or read the event ledger (event_totals): the business's billable events per UTC day, newest first, a page at a time (after: the cursor); or read its imports (imports): the one-time import allowance (null in Economico's own books), the events imported so far, what remains, and the cutoff: a change dated before it (when the business was created on Economico) is recorded as an import, free of monthly events, while the allowance lasts. Returns null for get if no profile has been recorded. Does not change the business.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/business/event-totals

Operation: business.event_totals


```json
{
  "operationId": "business.event_totals",
  "description": "Read the authenticated business's profile (including its fiscal year end and fiscal-year settings, and its sales-tax registrations in force), preview a fiscal-year change (effective_at, year_end MM-DD): its transition period and the fiscal years that follow; list the sales-tax regimes the business can register for in its country, with each regime's registration-number format and the tax codes registering would seed (sales_tax_regimes); read the platform plan (plan): free (the Solo plan), team (the Startup plan) or system, and, on team, the active Startup contract's id (read its terms through subjects to find a trial end or billing date); or read its Economico plan's event meter (meter): the monthly billing period running now, the billable events recorded in it so far and the allowance, and, while a cancelled plan's usage is closed, allowed: the most events the period permits (its included events, or the end of a started block the cancel billed; the period's total, not what is left); or read the event ledger (event_totals): the business's billable events per UTC day, newest first, a page at a time (after: the cursor); or read its imports (imports): the one-time import allowance (null in Economico's own books), the events imported so far, what remains, and the cutoff: a change dated before it (when the business was created on Economico) is recorded as an import, free of monthly events, while the allowance lasts. Returns null for get if no profile has been recorded. Does not change the business.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/business/imports

Operation: business.imports


```json
{
  "operationId": "business.imports",
  "description": "Read the authenticated business's profile (including its fiscal year end and fiscal-year settings, and its sales-tax registrations in force), preview a fiscal-year change (effective_at, year_end MM-DD): its transition period and the fiscal years that follow; list the sales-tax regimes the business can register for in its country, with each regime's registration-number format and the tax codes registering would seed (sales_tax_regimes); read the platform plan (plan): free (the Solo plan), team (the Startup plan) or system, and, on team, the active Startup contract's id (read its terms through subjects to find a trial end or billing date); or read its Economico plan's event meter (meter): the monthly billing period running now, the billable events recorded in it so far and the allowance, and, while a cancelled plan's usage is closed, allowed: the most events the period permits (its included events, or the end of a started block the cancel billed; the period's total, not what is left); or read the event ledger (event_totals): the business's billable events per UTC day, newest first, a page at a time (after: the cursor); or read its imports (imports): the one-time import allowance (null in Economico's own books), the events imported so far, what remains, and the cutoff: a change dated before it (when the business was created on Economico) is recorded as an import, free of monthly events, while the allowance lasts. Returns null for get if no profile has been recorded. Does not change the business.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/ingestions/{id}

Operation: ingestions.get


```json
{
  "operationId": "ingestions.get",
  "description": "Get document intake status, immutable source references and provenance, attachment status, processing revisions and financial execution by id. delivery describes processing; recordingDelivery describes automatic financial delivery, including exhausted failures requiring an operator retry. Pending uploads are independent of the primary source. This read does not return upload URLs or captured permissions; an upload URL appears only in the live response of the command that issued it — call ingestions.reissue_upload for a fresh one. A revision's extraction carries its exact retained text only when include_text is true (default false), which reads it from storage on every call; otherwise the extraction carries textBytes and its derived CID only, so a status poll stays cheap. Requires business read access for frozen identity context and document read access to every registered source and pending attachment kind.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "include_text",
      "in": "query",
      "required": false,
      "schema": {
        "type": "boolean"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/documents/{id}

Operation: documents.get


```json
{
  "operationId": "documents.get",
  "description": "Read immutable document metadata and exact bytes. Every row carries label (the founder word: Invoice, Bill, Payment receipt, Charge, Plan, Contract, …) and title; a statement also carries counterpartyId and, when its first effect is money, its headline amount (integer minor units) and currency. An activity, template or contract version also carries record, the type and id of the record it is a version of. Relations rows carry fromLabel, fromTitle, toLabel and toTitle (null when that document is missing). Get requires id and returns contentBase64; a source_document or image also carries size, its exact registered byte count. List supports kind, external_id, label and ids filters with an exclusive document-ID after cursor; ids takes 1–500 document ids and returns those the book holds, in id order (a repeat counts once). Label takes a record type's founder word (Invoice, Payment receipt, Bill, Bill payment, Refund, Credit note, Cancellation or Activity statement) and refuses any other word, so filter catalog documents by kind. Relations requires id and pages by the exclusive numeric after_id relation cursor.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "external_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "label",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/documents/{id}/relations

Operation: documents.relations


```json
{
  "operationId": "documents.relations",
  "description": "Read immutable document metadata and exact bytes. Every row carries label (the founder word: Invoice, Bill, Payment receipt, Charge, Plan, Contract, …) and title; a statement also carries counterpartyId and, when its first effect is money, its headline amount (integer minor units) and currency. An activity, template or contract version also carries record, the type and id of the record it is a version of. Relations rows carry fromLabel, fromTitle, toLabel and toTitle (null when that document is missing). Get requires id and returns contentBase64; a source_document or image also carries size, its exact registered byte count. List supports kind, external_id, label and ids filters with an exclusive document-ID after cursor; ids takes 1–500 document ids and returns those the book holds, in id order (a repeat counts once). Label takes a record type's founder word (Invoice, Payment receipt, Bill, Bill payment, Refund, Credit note, Cancellation or Activity statement) and refuses any other word, so filter catalog documents by kind. Relations requires id and pages by the exclusive numeric after_id relation cursor.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "external_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "label",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/events/{id}

Operation: events.get


```json
{
  "operationId": "events.get",
  "description": "Read event history and provenance. Every row carries commandName and the documents the event produced, each with its founder label (Invoice, Bill, Contract, …); a document.related row also carries relatedDocuments, the from and to documents its payload relates, each with id, kind, label and title (null when that document is missing). List is oldest first and pages by an exclusive numeric after cursor; with order desc it is newest first and pages by an exclusive numeric before cursor instead. Get requires id. List accepts footprint_contract_id to select only events with postings attributed to that contract by the ledger footprint, including independent payment allocations and reversals, under events.read authority. claim_contract_id instead selects only the events that posted to one of that contract's claims (its bills, invoices and refunds, and the payments, allocations, unallocations and reversals against them), found on the claim index, driven from the contract's claims to each event by id, so a page costs the contract's own postings, never the rest of the book's history; a contract that does not exist selects no events. payment_direction (in or out) selects only the payment.recorded events of payments in that direction that no reversal took back, on an index of payments by direction, so a page costs the page, never the book's history. A subject_id filter also needs its subject_type. kind_prefix narrows to event kinds in one or more namespaces, comma-separated (party.,party_contact.), which selects the business, document, party and financial-account events that carry no subject. Payload amounts are integer strings. An ingestion.* payload omits the delegation captured at intake (authority) and each upload's tokenHash, as the ingestions read does. No verification sweep is triggered.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "before",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "order",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "asc",
          "desc"
        ]
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "subject_type",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "subject_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "kind_prefix",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "footprint_contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "claim_contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "payment_direction",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "in",
          "out"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/subjects/{type}

Operation: subjects.list


```json
{
  "operationId": "subjects.list",
  "description": "Read derived lifecycle state. Call types first: it lists every subject type with its statuses and the filters its list accepts. List and get require type; get requires id. List supports status, the type's declared filters (email, code, contract_id, activity_key, document_id, record_type, plan, kind, party_id, activity_document_id, template_document_id), ids (1–500 subject ids of the type, those it holds in id order) and an exclusive subject-ID after cursor; a filter the type does not declare is refused. The contract kind filter accepts customer, vendor, investment or other, derived from its saved roles and rights; it returns busy while bounded historical index catch-up is pending, and requires schema 27. On contracts, party_id lists those naming a party in any role, activity_document_id those binding a right's document version and template_document_id those made from a template or plan document version; each of these two also takes a list of 1–500 versions and matches a contract on any of them, with no other filter; otherwise filters combine. Activity and template rows carry versions, every document the record has been, oldest first. An activity_occurrence's state carries recordType (invoice, payment_receipt, bill, bill_payment, refund, credit_note, cancellation or activity_statement), and record_type filters by it. Types carry a founder label and note; activity, template, contract and activity_occurrence rows carry label and title (an occurrence also counterpartyId and, when its headline effect is money, amount, currency and decimals). An invoice, bill or receipt is titled by its occurrence key; a recording that moved nothing (an acceptance, a delivery) by the name of the activity it ran; correlate on state.occurrenceKey, never on title.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "type",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "effective_at",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    },
    {
      "name": "email",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "activity_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "document_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "record_type",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "plan",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "customer",
          "vendor",
          "investment",
          "other"
        ]
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "activity_document_id",
      "in": "query",
      "required": false,
      "schema": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "minItems": 1,
            "maxItems": 500
          }
        ],
        "description": "One document version, or a list of 1–500 to match a contract on any of them."
      }
    },
    {
      "name": "template_document_id",
      "in": "query",
      "required": false,
      "schema": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "minItems": 1,
            "maxItems": 500
          }
        ],
        "description": "One document version, or a list of 1–500 to match a contract on any of them."
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/ledgers/{ledger_id}

Operation: ledgers.get


```json
{
  "operationId": "ledgers.get",
  "description": "Read native-unit ledger metadata, balances and posting statements. Get, balances and statement require ledger_id. Balances returns one ledger's per-(account, sub-key) debits, credits and balance in its own unit — the balance read for usage meters, prepaid capacity and share classes as well as currency ledgers; account_code (and, with it, sub_key) narrows it to that account's rows, summed on the account index; an optional as_of limits it to postings up to that point (a YYYY-MM-DD date includes that whole UTC day; a UTC timestamp counts postings before it), sub-keys intact. Statement pages postings by the exclusive numeric after_id cursor and can be narrowed to one account_code and, with it, one sub_key (the statement's own subKey string). List pages by the exclusive string ledger-ID after cursor. Currencies names each currency the business's GAAP ledgers hold real postings in, once, and in ledgers the ledger that holds it now (the open one, else the most recently closed; a functional-currency change or an incorporation succeeds a currency's ledger). A business starts with its selected functional-currency ledger (USD when omitted); other canonical currency ledgers open when a contract first binds them. Amounts remain exact strings and are never summed across units. Transaction requires occurrence_id (an invoice, bill or payment record) and returns every posting of every event that touched its claims (the record itself, the payments, credits and corrections against it, with each correction's reversal), in effective order, each with the record it came from, plus otherClaims: other invoices or bills those events also settled. Footprint takes exactly one of party_id, contract_id or occurrence_id and returns every posting of every recording on that party's contracts, on that contract, or in that record's transaction, in effective order, each attributed to its record (occurrenceId, occurrenceKey), activity, pattern and party the way the activity_balances report attributes it, with its ledger's unit and decimals; plus contracts, the contracts it spans. Null when the party, contract or record does not exist.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "ledger_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "occurrence_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "account_code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "event_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "sub_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/ledgers/{ledger_id}/balances

Operation: ledgers.balances


```json
{
  "operationId": "ledgers.balances",
  "description": "Read native-unit ledger metadata, balances and posting statements. Get, balances and statement require ledger_id. Balances returns one ledger's per-(account, sub-key) debits, credits and balance in its own unit — the balance read for usage meters, prepaid capacity and share classes as well as currency ledgers; account_code (and, with it, sub_key) narrows it to that account's rows, summed on the account index; an optional as_of limits it to postings up to that point (a YYYY-MM-DD date includes that whole UTC day; a UTC timestamp counts postings before it), sub-keys intact. Statement pages postings by the exclusive numeric after_id cursor and can be narrowed to one account_code and, with it, one sub_key (the statement's own subKey string). List pages by the exclusive string ledger-ID after cursor. Currencies names each currency the business's GAAP ledgers hold real postings in, once, and in ledgers the ledger that holds it now (the open one, else the most recently closed; a functional-currency change or an incorporation succeeds a currency's ledger). A business starts with its selected functional-currency ledger (USD when omitted); other canonical currency ledgers open when a contract first binds them. Amounts remain exact strings and are never summed across units. Transaction requires occurrence_id (an invoice, bill or payment record) and returns every posting of every event that touched its claims (the record itself, the payments, credits and corrections against it, with each correction's reversal), in effective order, each with the record it came from, plus otherClaims: other invoices or bills those events also settled. Footprint takes exactly one of party_id, contract_id or occurrence_id and returns every posting of every recording on that party's contracts, on that contract, or in that record's transaction, in effective order, each attributed to its record (occurrenceId, occurrenceKey), activity, pattern and party the way the activity_balances report attributes it, with its ledger's unit and decimals; plus contracts, the contracts it spans. Null when the party, contract or record does not exist.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "ledger_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "occurrence_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "account_code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "event_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "sub_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/ledgers/{ledger_id}/statement

Operation: ledgers.statement


```json
{
  "operationId": "ledgers.statement",
  "description": "Read native-unit ledger metadata, balances and posting statements. Get, balances and statement require ledger_id. Balances returns one ledger's per-(account, sub-key) debits, credits and balance in its own unit — the balance read for usage meters, prepaid capacity and share classes as well as currency ledgers; account_code (and, with it, sub_key) narrows it to that account's rows, summed on the account index; an optional as_of limits it to postings up to that point (a YYYY-MM-DD date includes that whole UTC day; a UTC timestamp counts postings before it), sub-keys intact. Statement pages postings by the exclusive numeric after_id cursor and can be narrowed to one account_code and, with it, one sub_key (the statement's own subKey string). List pages by the exclusive string ledger-ID after cursor. Currencies names each currency the business's GAAP ledgers hold real postings in, once, and in ledgers the ledger that holds it now (the open one, else the most recently closed; a functional-currency change or an incorporation succeeds a currency's ledger). A business starts with its selected functional-currency ledger (USD when omitted); other canonical currency ledgers open when a contract first binds them. Amounts remain exact strings and are never summed across units. Transaction requires occurrence_id (an invoice, bill or payment record) and returns every posting of every event that touched its claims (the record itself, the payments, credits and corrections against it, with each correction's reversal), in effective order, each with the record it came from, plus otherClaims: other invoices or bills those events also settled. Footprint takes exactly one of party_id, contract_id or occurrence_id and returns every posting of every recording on that party's contracts, on that contract, or in that record's transaction, in effective order, each attributed to its record (occurrenceId, occurrenceKey), activity, pattern and party the way the activity_balances report attributes it, with its ledger's unit and decimals; plus contracts, the contracts it spans. Null when the party, contract or record does not exist.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "ledger_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "occurrence_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "account_code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "event_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "sub_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/ledgers/{ledger_id}/currencies

Operation: ledgers.currencies


```json
{
  "operationId": "ledgers.currencies",
  "description": "Read native-unit ledger metadata, balances and posting statements. Get, balances and statement require ledger_id. Balances returns one ledger's per-(account, sub-key) debits, credits and balance in its own unit — the balance read for usage meters, prepaid capacity and share classes as well as currency ledgers; account_code (and, with it, sub_key) narrows it to that account's rows, summed on the account index; an optional as_of limits it to postings up to that point (a YYYY-MM-DD date includes that whole UTC day; a UTC timestamp counts postings before it), sub-keys intact. Statement pages postings by the exclusive numeric after_id cursor and can be narrowed to one account_code and, with it, one sub_key (the statement's own subKey string). List pages by the exclusive string ledger-ID after cursor. Currencies names each currency the business's GAAP ledgers hold real postings in, once, and in ledgers the ledger that holds it now (the open one, else the most recently closed; a functional-currency change or an incorporation succeeds a currency's ledger). A business starts with its selected functional-currency ledger (USD when omitted); other canonical currency ledgers open when a contract first binds them. Amounts remain exact strings and are never summed across units. Transaction requires occurrence_id (an invoice, bill or payment record) and returns every posting of every event that touched its claims (the record itself, the payments, credits and corrections against it, with each correction's reversal), in effective order, each with the record it came from, plus otherClaims: other invoices or bills those events also settled. Footprint takes exactly one of party_id, contract_id or occurrence_id and returns every posting of every recording on that party's contracts, on that contract, or in that record's transaction, in effective order, each attributed to its record (occurrenceId, occurrenceKey), activity, pattern and party the way the activity_balances report attributes it, with its ledger's unit and decimals; plus contracts, the contracts it spans. Null when the party, contract or record does not exist.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "ledger_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "occurrence_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "account_code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "event_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "sub_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/ledgers/{ledger_id}/transaction

Operation: ledgers.transaction


```json
{
  "operationId": "ledgers.transaction",
  "description": "Read native-unit ledger metadata, balances and posting statements. Get, balances and statement require ledger_id. Balances returns one ledger's per-(account, sub-key) debits, credits and balance in its own unit — the balance read for usage meters, prepaid capacity and share classes as well as currency ledgers; account_code (and, with it, sub_key) narrows it to that account's rows, summed on the account index; an optional as_of limits it to postings up to that point (a YYYY-MM-DD date includes that whole UTC day; a UTC timestamp counts postings before it), sub-keys intact. Statement pages postings by the exclusive numeric after_id cursor and can be narrowed to one account_code and, with it, one sub_key (the statement's own subKey string). List pages by the exclusive string ledger-ID after cursor. Currencies names each currency the business's GAAP ledgers hold real postings in, once, and in ledgers the ledger that holds it now (the open one, else the most recently closed; a functional-currency change or an incorporation succeeds a currency's ledger). A business starts with its selected functional-currency ledger (USD when omitted); other canonical currency ledgers open when a contract first binds them. Amounts remain exact strings and are never summed across units. Transaction requires occurrence_id (an invoice, bill or payment record) and returns every posting of every event that touched its claims (the record itself, the payments, credits and corrections against it, with each correction's reversal), in effective order, each with the record it came from, plus otherClaims: other invoices or bills those events also settled. Footprint takes exactly one of party_id, contract_id or occurrence_id and returns every posting of every recording on that party's contracts, on that contract, or in that record's transaction, in effective order, each attributed to its record (occurrenceId, occurrenceKey), activity, pattern and party the way the activity_balances report attributes it, with its ledger's unit and decimals; plus contracts, the contracts it spans. Null when the party, contract or record does not exist.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "ledger_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "occurrence_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "account_code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "event_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "sub_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/ledgers/{ledger_id}/footprint

Operation: ledgers.footprint


```json
{
  "operationId": "ledgers.footprint",
  "description": "Read native-unit ledger metadata, balances and posting statements. Get, balances and statement require ledger_id. Balances returns one ledger's per-(account, sub-key) debits, credits and balance in its own unit — the balance read for usage meters, prepaid capacity and share classes as well as currency ledgers; account_code (and, with it, sub_key) narrows it to that account's rows, summed on the account index; an optional as_of limits it to postings up to that point (a YYYY-MM-DD date includes that whole UTC day; a UTC timestamp counts postings before it), sub-keys intact. Statement pages postings by the exclusive numeric after_id cursor and can be narrowed to one account_code and, with it, one sub_key (the statement's own subKey string). List pages by the exclusive string ledger-ID after cursor. Currencies names each currency the business's GAAP ledgers hold real postings in, once, and in ledgers the ledger that holds it now (the open one, else the most recently closed; a functional-currency change or an incorporation succeeds a currency's ledger). A business starts with its selected functional-currency ledger (USD when omitted); other canonical currency ledgers open when a contract first binds them. Amounts remain exact strings and are never summed across units. Transaction requires occurrence_id (an invoice, bill or payment record) and returns every posting of every event that touched its claims (the record itself, the payments, credits and corrections against it, with each correction's reversal), in effective order, each with the record it came from, plus otherClaims: other invoices or bills those events also settled. Footprint takes exactly one of party_id, contract_id or occurrence_id and returns every posting of every recording on that party's contracts, on that contract, or in that record's transaction, in effective order, each attributed to its record (occurrenceId, occurrenceKey), activity, pattern and party the way the activity_balances report attributes it, with its ledger's unit and decimals; plus contracts, the contracts it spans. Null when the party, contract or record does not exist.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "ledger_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "occurrence_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "account_code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "event_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "sub_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "as_of",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/parties/{id}

Operation: parties.get


```json
{
  "operationId": "parties.get",
  "description": "Read counterparties and contacts. Get requires id. List uses an exclusive party-ID after cursor and includes archived records; category narrows it to parties playing that role (customer, vendor, founder, investor, provider, employee), and vendor also matches providers; ids (1–500 party ids) narrows it to those, in id order. Categories returns the relationship categories in use.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "category",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/accounts/{id}

Operation: accounts.get


```json
{
  "operationId": "accounts.get",
  "description": "Read registered financial accounts, their currency, provider, brand color, logo and default status. Get, activity, overview and summary require id. Summary also requires month (YYYY-MM, UTC); summaries takes 1–100 ids and month and returns the same figures in an items array. Both return exact balance and spending integer strings without movements (spent is null for ambiguous manual journals); transfers, funding, card repayments, customer refunds and collected-tax remittances are excluded. Activity returns the account's recent recorded payment effects and provider fees with their exact total. Overview returns what the account's page shows: the GL account it is held on (2135 keyed to the owner for a person's own card, whose balance is what the company owes that person across all their own accounts) and its balance; the latest movements (limit caps them, newest first; count is the total), each signed by the account's normal balance with its counterparty, running balance, counter accounts and, through a settled bill, the expense accounts it landed on; totals by month, counter account, expense account and counterparty; and its payment endpoints with full payto/CAIP-10 URIs and rails. List uses an exclusive financial-account-ID after cursor and includes archived accounts; ids (1–100 account ids) narrows it to those, in id order.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/accounts/{id}/activity

Operation: accounts.activity


```json
{
  "operationId": "accounts.activity",
  "description": "Read registered financial accounts, their currency, provider, brand color, logo and default status. Get, activity, overview and summary require id. Summary also requires month (YYYY-MM, UTC); summaries takes 1–100 ids and month and returns the same figures in an items array. Both return exact balance and spending integer strings without movements (spent is null for ambiguous manual journals); transfers, funding, card repayments, customer refunds and collected-tax remittances are excluded. Activity returns the account's recent recorded payment effects and provider fees with their exact total. Overview returns what the account's page shows: the GL account it is held on (2135 keyed to the owner for a person's own card, whose balance is what the company owes that person across all their own accounts) and its balance; the latest movements (limit caps them, newest first; count is the total), each signed by the account's normal balance with its counterparty, running balance, counter accounts and, through a settled bill, the expense accounts it landed on; totals by month, counter account, expense account and counterparty; and its payment endpoints with full payto/CAIP-10 URIs and rails. List uses an exclusive financial-account-ID after cursor and includes archived accounts; ids (1–100 account ids) narrows it to those, in id order.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/accounts/{id}/overview

Operation: accounts.overview


```json
{
  "operationId": "accounts.overview",
  "description": "Read registered financial accounts, their currency, provider, brand color, logo and default status. Get, activity, overview and summary require id. Summary also requires month (YYYY-MM, UTC); summaries takes 1–100 ids and month and returns the same figures in an items array. Both return exact balance and spending integer strings without movements (spent is null for ambiguous manual journals); transfers, funding, card repayments, customer refunds and collected-tax remittances are excluded. Activity returns the account's recent recorded payment effects and provider fees with their exact total. Overview returns what the account's page shows: the GL account it is held on (2135 keyed to the owner for a person's own card, whose balance is what the company owes that person across all their own accounts) and its balance; the latest movements (limit caps them, newest first; count is the total), each signed by the account's normal balance with its counterparty, running balance, counter accounts and, through a settled bill, the expense accounts it landed on; totals by month, counter account, expense account and counterparty; and its payment endpoints with full payto/CAIP-10 URIs and rails. List uses an exclusive financial-account-ID after cursor and includes archived accounts; ids (1–100 account ids) narrows it to those, in id order.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/accounts/{id}/summary

Operation: accounts.summary


```json
{
  "operationId": "accounts.summary",
  "description": "Read registered financial accounts, their currency, provider, brand color, logo and default status. Get, activity, overview and summary require id. Summary also requires month (YYYY-MM, UTC); summaries takes 1–100 ids and month and returns the same figures in an items array. Both return exact balance and spending integer strings without movements (spent is null for ambiguous manual journals); transfers, funding, card repayments, customer refunds and collected-tax remittances are excluded. Activity returns the account's recent recorded payment effects and provider fees with their exact total. Overview returns what the account's page shows: the GL account it is held on (2135 keyed to the owner for a person's own card, whose balance is what the company owes that person across all their own accounts) and its balance; the latest movements (limit caps them, newest first; count is the total), each signed by the account's normal balance with its counterparty, running balance, counter accounts and, through a settled bill, the expense accounts it landed on; totals by month, counter account, expense account and counterparty; and its payment endpoints with full payto/CAIP-10 URIs and rails. List uses an exclusive financial-account-ID after cursor and includes archived accounts; ids (1–100 account ids) narrows it to those, in id order.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "month",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])$"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/categories/{id}

Operation: categories.get


```json
{
  "operationId": "categories.get",
  "description": "Read revenue categories. Get requires id. List pages by exclusive category-ID cursor.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/tax_codes/{id}

Operation: tax_codes.get


```json
{
  "operationId": "tax_codes.get",
  "description": "Read configured tax codes: role (output, input, reverse_charge, imported_services, non_recoverable), rate in parts per million, effective period, the liability it credits and the sales-tax regime that seeded it. Get requires id. List includes inactive codes and pages by exclusive tax-code-ID cursor.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/shared_views/{id}

Operation: shared_views.get


```json
{
  "operationId": "shared_views.get",
  "description": "List this business's capability links (shared views): every share ever created, revoked ones included with their revoking event, oldest first, with the token each resolves at /e/{slug}/share/{token} on this server. Pages by the exclusive view-ID after cursor. Create and revoke through the shared_views.create and shared_views.revoke commands.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/subjects/{type}/{id}

Operation: subjects.get


```json
{
  "operationId": "subjects.get",
  "description": "Read derived lifecycle state. Call types first: it lists every subject type with its statuses and the filters its list accepts. List and get require type; get requires id. List supports status, the type's declared filters (email, code, contract_id, activity_key, document_id, record_type, plan, kind, party_id, activity_document_id, template_document_id), ids (1–500 subject ids of the type, those it holds in id order) and an exclusive subject-ID after cursor; a filter the type does not declare is refused. The contract kind filter accepts customer, vendor, investment or other, derived from its saved roles and rights; it returns busy while bounded historical index catch-up is pending, and requires schema 27. On contracts, party_id lists those naming a party in any role, activity_document_id those binding a right's document version and template_document_id those made from a template or plan document version; each of these two also takes a list of 1–500 versions and matches a contract on any of them, with no other filter; otherwise filters combine. Activity and template rows carry versions, every document the record has been, oldest first. An activity_occurrence's state carries recordType (invoice, payment_receipt, bill, bill_payment, refund, credit_note, cancellation or activity_statement), and record_type filters by it. Types carry a founder label and note; activity, template, contract and activity_occurrence rows carry label and title (an occurrence also counterpartyId and, when its headline effect is money, amount, currency and decimals). An invoice, bill or receipt is titled by its occurrence key; a recording that moved nothing (an acceptance, a delivery) by the name of the activity it ran; correlate on state.occurrenceKey, never on title.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 500,
        "default": 100
      }
    },
    {
      "name": "type",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "effective_at",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minItems": 1,
        "maxItems": 500
      }
    },
    {
      "name": "email",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "code",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "contract_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "activity_key",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "document_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "record_type",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "plan",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "customer",
          "vendor",
          "investment",
          "other"
        ]
      }
    },
    {
      "name": "party_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "minLength": 1
      }
    },
    {
      "name": "activity_document_id",
      "in": "query",
      "required": false,
      "schema": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "minItems": 1,
            "maxItems": 500
          }
        ],
        "description": "One document version, or a list of 1–500 to match a contract on any of them."
      }
    },
    {
      "name": "template_document_id",
      "in": "query",
      "required": false,
      "schema": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "minItems": 1,
            "maxItems": 500
          }
        ],
        "description": "One document version, or a list of 1–500 to match a contract on any of them."
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/logos

Operation: logos.uploadInfo


```json
{
  "operationId": "logos.uploadInfo",
  "description": "Shared public raster logo upload requirements and this business's own images, published and pending, at most 21 per page in CID order; `next` is the `after` for the next page, or null. Uploading this image makes it public until the business deletes it. Anyone with its link can view it. Exact bytes, including EXIF metadata such as GPS location, are retained; downloaded copies may remain after deletion, and cached copies can be served for about five minutes after it. Requires party-management authority.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "description": "Continue after this CID"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "images",
              "next"
            ],
            "properties": {
              "images": {
                "type": "array",
                "maxItems": 21,
                "items": {
                  "type": "object",
                  "required": [
                    "cid",
                    "url",
                    "mediaType",
                    "width",
                    "height",
                    "bytesLength",
                    "status"
                  ],
                  "properties": {
                    "cid": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "mediaType": {
                      "enum": [
                        "image/png",
                        "image/jpeg",
                        "image/webp"
                      ]
                    },
                    "width": {
                      "type": "integer"
                    },
                    "height": {
                      "type": "integer"
                    },
                    "bytesLength": {
                      "type": "integer"
                    },
                    "status": {
                      "enum": [
                        "published",
                        "pending"
                      ]
                    }
                  }
                }
              },
              "next": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## POST /v1/logos

Operation: logos.upload


```json
{
  "operationId": "logos.upload",
  "description": "Uploading this image makes it public until the business deletes it. Anyone with its link can view it. Exact bytes, including EXIF metadata such as GPS location, are retained; downloaded copies may remain after deletion, and cached copies can be served for about five minutes after it. Publishes exact PNG, JPEG or WebP bytes (up to 256 KiB and 1024 pixels per dimension) until the business deletes them. Returns a CID and opaque owner URL. Requires party-management authority. Identical bytes within one business reuse the URL; another business receives a different URL. With X-Economico-Replace-Logo, which requires `parties.update`, the business must hold the replaced image (or already hold the new one from an earlier attempt): the new image is published first and may use the replaced image's storage, then the replaced image is deleted; the response adds `replaced`.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "X-Economico-Publish-Logo",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string",
        "const": "true"
      }
    },
    {
      "name": "X-Economico-Replace-Logo",
      "in": "header",
      "required": false,
      "schema": {
        "type": "string",
        "description": "CID of this business's image to replace"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "image/png": {
        "schema": {
          "type": "string",
          "format": "binary",
          "x-max-bytes": 262144
        }
      },
      "image/jpeg": {
        "schema": {
          "type": "string",
          "format": "binary",
          "x-max-bytes": 262144
        }
      },
      "image/webp": {
        "schema": {
          "type": "string",
          "format": "binary",
          "x-max-bytes": 262144
        }
      },
      "application/octet-stream": {
        "schema": {
          "type": "string",
          "format": "binary",
          "x-max-bytes": 262144
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "cid",
              "url",
              "mediaType",
              "width",
              "height",
              "bytesLength"
            ],
            "properties": {
              "cid": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "mediaType": {
                "enum": [
                  "image/png",
                  "image/jpeg",
                  "image/webp"
                ]
              },
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              },
              "bytesLength": {
                "type": "integer"
              },
              "replaced": {
                "type": "object",
                "required": [
                  "cid",
                  "deleted"
                ],
                "properties": {
                  "cid": {
                    "type": "string"
                  },
                  "deleted": {
                    "type": "boolean"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "The link that stopped resolving"
                  }
                }
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## DELETE /v1/logos/{cid}

Operation: logos.delete


```json
{
  "operationId": "logos.delete",
  "description": "Deletes this business's copy of a public image, published or still pending, and frees its storage budget. Its link stops resolving everywhere it was copied, including issued documents, within about five minutes as cached copies expire (max-age=300); downloaded copies cannot be recalled. Another business's identical image is unaffected. Deleting a CID the business holds no image for returns `deleted: false`, unless a late write left bytes under its namespace: those are removed, answering `deleted: true`. A business may start at most 50 deletions and replacements of published images per UTC day (`logo_churn_exceeded`, HTTP 429, refused before anything changes). Requires `parties.update`.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "cid",
              "deleted"
            ],
            "properties": {
              "cid": {
                "type": "string"
              },
              "deleted": {
                "type": "boolean"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The link that stopped resolving"
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## POST /v1/reports

Operation: reports.run


```json
{
  "operationId": "reports.run",
  "description": "Run one public report. Monetary values are integer strings; ratios and assumptions may be fractional numbers.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "payroll_provider"
                },
                "provider_party_id": {
                  "description": "Payroll provider party to filter.",
                  "type": "string",
                  "minLength": 1
                },
                "limit": {
                  "description": "Maximum rows per page, up to 100 (default 100).",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "after": {
                  "description": "Opaque nextCursor from the preceding report page with the same filters.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "provider_party_id"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "people_costs"
                },
                "from_month": {
                  "description": "First month, YYYY-MM.",
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^[0-9]{4}-[0-9]{2}$"
                },
                "through_month": {
                  "description": "Last month, YYYY-MM (default: this month).",
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^[0-9]{4}-[0-9]{2}$"
                },
                "person_party_id": {
                  "description": "Stable person party to filter.",
                  "type": "string",
                  "minLength": 1
                },
                "provider_party_id": {
                  "description": "Payroll provider party to filter.",
                  "type": "string",
                  "minLength": 1
                },
                "limit": {
                  "description": "Maximum rows per page, up to 100 (default 100).",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "after": {
                  "description": "Opaque nextCursor from the preceding report page with the same filters.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "from_month"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "concessions"
                },
                "from_month": {
                  "description": "First month, YYYY-MM.",
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^[0-9]{4}-[0-9]{2}$"
                },
                "through_month": {
                  "description": "Last month, YYYY-MM (default: this month).",
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^[0-9]{4}-[0-9]{2}$"
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "from_month"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "usage_estimates"
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "from": {
                  "description": "Start date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day.",
                  "type": "string",
                  "minLength": 1
                },
                "until": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day, so September ends at 2026-09-30; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "limit": {
                  "description": "Maximum rows per page, up to 100 (default 100).",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "after": {
                  "description": "Opaque nextCursor from the preceding report page with the same filters.",
                  "type": "string",
                  "minLength": 1
                },
                "unbilled_after": {
                  "description": "unbilledNextCursor from the preceding page's unbilled estimates.",
                  "type": "string",
                  "minLength": 1
                },
                "unmatched_after": {
                  "description": "unmatchedNextCursor from the preceding page's unmatched invoice lines.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "contract_id"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "usage_cost"
                },
                "from": {
                  "description": "Start date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day.",
                  "type": "string",
                  "minLength": 1
                },
                "until": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day, so September ends at 2026-09-30; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "limit": {
                  "description": "Maximum rows per page, up to 100 (default 100).",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "after": {
                  "description": "Opaque nextCursor from the preceding report page with the same filters.",
                  "type": "string",
                  "minLength": 1
                },
                "group_by": {
                  "description": "Attribution dimension to show (default customer).",
                  "type": "string",
                  "minLength": 1,
                  "enum": [
                    "customer",
                    "holder",
                    "team",
                    "project"
                  ]
                },
                "attribution_value": {
                  "description": "Select this exact customer id, holder, team or project in group_by.",
                  "type": "string",
                  "minLength": 1
                },
                "view": {
                  "description": "running includes estimates and reconciled cost; billed keeps closed usage periods (default running).",
                  "type": "string",
                  "minLength": 1,
                  "enum": [
                    "running",
                    "billed"
                  ]
                }
              },
              "required": [
                "kind",
                "from",
                "until"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "vendor_utilization"
                },
                "from": {
                  "description": "Start date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day.",
                  "type": "string",
                  "minLength": 1
                },
                "until": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day, so September ends at 2026-09-30; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "limit": {
                  "description": "Maximum rows per page, up to 100 (default 100).",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "after": {
                  "description": "Opaque nextCursor from the preceding report page with the same filters.",
                  "type": "string",
                  "minLength": 1
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "usage_after": {
                  "description": "The contract row's usageNextCursor; requires contract_id and the same report filters.",
                  "type": "string",
                  "minLength": 1
                },
                "unused_days": {
                  "description": "Days without use that make a paid contract unused (default 60).",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3650
                }
              },
              "required": [
                "kind",
                "from",
                "until"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "contract_deadlines"
                },
                "through": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day; a timestamp includes everything up to and including that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "limit": {
                  "description": "Maximum rows per page, up to 100 (default 100).",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "cursor": {
                  "description": "Opaque cursor returned by the previous deadlines page.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "through"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "fx_rate"
                },
                "base": {
                  "description": "Source ISO 4217 currency code.",
                  "type": "string",
                  "minLength": 1
                },
                "quote": {
                  "description": "Destination ISO 4217 currency code; defaults to functional currency.",
                  "type": "string",
                  "minLength": 1
                },
                "date": {
                  "description": "Requested rate day (YYYY-MM-DD or UTC RFC 3339 instant); defaults to the runtime day. Future days are refused.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "base"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "activity_balances"
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "activity_key": {
                  "description": "Activity binding key within the contract.",
                  "type": "string",
                  "minLength": 1
                },
                "party_id": {
                  "description": "Party subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "ledger_id": {
                  "description": "Native ledger ID.",
                  "type": "string",
                  "minLength": 1
                },
                "account_code": {
                  "description": "Native chart account code.",
                  "type": "integer",
                  "minimum": 1
                }
              },
              "required": [
                "kind",
                "as_of"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "party_contract_values"
                },
                "party_ids": {
                  "description": "One or more party ids, comma-separated, e.g. pty_a,pty_b (at most 50; spaces around commas are ignored).",
                  "type": "string",
                  "minLength": 1
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "contract_value_only": {
                  "description": "true returns only party/side/unit identity and contractValue, using maintained effective-time totals for list reads; cannot be combined with by_contract. valueSource describes maintained, mixed or computed fallback reads.",
                  "type": "boolean"
                },
                "by_contract": {
                  "description": "true splits each row by contract, adding contractId, contractName and annualised (the row holds an open-ended right's one year rather than only a committed term); the rows add up to those without it.",
                  "type": "boolean"
                }
              },
              "required": [
                "kind",
                "party_ids"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "activity_claims"
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "party_id": {
                  "description": "Party subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "open": {
                  "description": "true returns only the party's claims still open now (needs party_id; no as_of).",
                  "type": "boolean"
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "contract_books"
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "contract_id"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "activity_plan"
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "from": {
                  "description": "Start date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day.",
                  "type": "string",
                  "minLength": 1
                },
                "through": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day; a timestamp includes everything up to and including that moment.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "contract_id",
                "from",
                "through"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "pipeline"
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "activity_capacity"
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "contract_id",
                "as_of"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "activity_effects"
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "activity_key": {
                  "description": "Activity binding key within the contract.",
                  "type": "string",
                  "minLength": 1
                },
                "occurrence_key": {
                  "description": "Stable occurrence key for exact billing claim identities; omitted previews use an unrecorded preview identity.",
                  "type": "string",
                  "minLength": 1
                },
                "effective_at": {
                  "description": "Effective date (YYYY-MM-DD) or RFC 3339 instant for activity evaluation and balances.",
                  "type": "string",
                  "minLength": 1
                },
                "facts": {
                  "description": "Named observed facts: integer amounts as decimal strings, dates and text. Required names and units come from the bound activity.",
                  "type": "object",
                  "maxProperties": 100,
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "owner_balance"
                },
                "party_id": {
                  "description": "Party subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "party_id",
                "as_of"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "balances"
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "mapped_trial_balance"
                },
                "package_id": {
                  "description": "Exact immutable reporting-profile package ID; no jurisdiction fallback.",
                  "type": "string",
                  "minLength": 1
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                },
                "presentation": {
                  "description": "Reference to one exact evidenced source-to-national-currency rate event when the selected statutory package requires a presentation currency different from the native ledger.",
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "rate_event_id"
                  ],
                  "properties": {
                    "rate_event_id": {
                      "type": "integer",
                      "minimum": 1
                    }
                  }
                }
              },
              "required": [
                "kind",
                "package_id",
                "as_of"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "balance_sheet"
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "capital_accounts"
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "income_statement"
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                },
                "from": {
                  "description": "Start date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day.",
                  "type": "string",
                  "minLength": 1
                },
                "until": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day, so September ends at 2026-09-30; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "window": {
                  "description": "Instead of from/until: all, YYYY, YYYY-Qn, YYYY-MM, or ytd / qtd / mtd (to the moment the report runs).",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "income_statement_periods"
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                },
                "through_month": {
                  "description": "Last month, YYYY-MM (default: this month).",
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^[0-9]{4}-[0-9]{2}$"
                },
                "months": {
                  "description": "How many monthly columns, 2–24 (default 6).",
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 24
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "revenue_summary"
                },
                "period_start": {
                  "description": "Start date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day.",
                  "type": "string",
                  "minLength": 1
                },
                "period_end": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day, so September ends at 2026-09-30; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "period_start",
                "period_end"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "recognition"
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "through": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day; a timestamp includes everything up to and including that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "party_id": {
                  "description": "Party subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "document_id": {
                  "description": "An invoice or bill document. Priced rights follow its obligation through recognition; right-scoped refunds without document attribution refuse this filter.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "as_of"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "amortization"
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "contract_id": {
                  "description": "Resolved activity-contract subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "through": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day; a timestamp includes everything up to and including that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "party_id": {
                  "description": "Party subject ID.",
                  "type": "string",
                  "minLength": 1
                },
                "document_id": {
                  "description": "An invoice or bill document. Priced rights follow its obligation through recognition; right-scoped refunds without document attribution refuse this filter.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "as_of"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "aging"
                },
                "bill_cursor": {
                  "description": "The previous vendor bill page's next_cursor; requires include_settled=true, direction=payable and party_id.",
                  "type": "string",
                  "minLength": 1
                },
                "include_settled": {
                  "description": "A vendor page: with direction=payable and party_id, return up to 50 recent bills including settled bills and their actual payment account; next_cursor and truncated signal another page; pass bill_cursor to continue.",
                  "type": "boolean"
                },
                "direction": {
                  "description": "receivable (default) or payable.",
                  "type": "string",
                  "minLength": 1,
                  "enum": [
                    "receivable",
                    "payable"
                  ]
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "party_id": {
                  "description": "Party subject ID.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "as_of"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "saas_metrics"
                },
                "year": {
                  "description": "Calendar year (not the business fiscal year); quarter is a calendar quarter.",
                  "type": "integer",
                  "minimum": 2000,
                  "maximum": 2100
                },
                "month": {
                  "description": "Month; exclusive with quarter.",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 12
                },
                "quarter": {
                  "description": "Quarter; exclusive with month.",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 4
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "trend": {
                  "description": "true adds a 12-month series per supported metric ending at the month (month granularity only).",
                  "type": "boolean"
                }
              },
              "required": [
                "kind",
                "year"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "default_alive"
                },
                "period": {
                  "description": "YYYY-MM.",
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^[0-9]{4}-[0-9]{2}$"
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                },
                "cash_minor_units": {
                  "description": "What-if: cash in minor units (integer string) instead of the books'.",
                  "type": "string",
                  "minLength": 1
                },
                "monthly_revenue_minor_units": {
                  "description": "What-if: monthly revenue in minor units (integer string).",
                  "type": "string",
                  "minLength": 1
                },
                "monthly_expenses_minor_units": {
                  "description": "What-if: monthly expenses in minor units (integer string).",
                  "type": "string",
                  "minLength": 1
                },
                "monthly_growth_rate": {
                  "description": "What-if: month-over-month revenue growth as a decimal, e.g. 0.12 for 12%.",
                  "type": "number",
                  "exclusiveMinimum": -1,
                  "maximum": 5
                },
                "exclude_startup_credits": {
                  "description": "true adds back promotional/startup credits applied this month (5950).",
                  "type": "boolean"
                }
              },
              "required": [
                "kind",
                "period"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "unit_economics"
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                },
                "from": {
                  "description": "Start date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day.",
                  "type": "string",
                  "minLength": 1
                },
                "until": {
                  "description": "End date (YYYY-MM-DD) or UTC timestamp (RFC 3339). A date is a UTC day and includes that whole day, so September ends at 2026-09-30; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "platform_fees"
                },
                "period": {
                  "description": "YYYY-MM.",
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^[0-9]{4}-[0-9]{2}$"
                }
              },
              "required": [
                "kind",
                "period"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "model_preview"
                },
                "model": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "plans"
                  ],
                  "properties": {
                    "company": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    "sells": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000,
                      "description": "What the company sells, to whom, and how it is delivered."
                    },
                    "plans": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "key",
                          "name",
                          "cadence"
                        ],
                        "properties": {
                          "key": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "description": "The plan's id in this proposal; customers name it."
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "price": {
                            "type": "string",
                            "description": "Minor units as an integer string: 4900 is $49.00."
                          },
                          "currency": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "description": "Supported ISO currency; defaults to the report currency."
                          },
                          "pricing": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "description": "Variable or tiered price terms; omit price when unknown."
                          },
                          "cadence": {
                            "enum": [
                              "month",
                              "year",
                              "one_time",
                              "usage"
                            ],
                            "description": "When it bills: usage is priced per unit."
                          },
                          "includes": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "overage": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "template": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "description": "The template this plan will become."
                          },
                          "source": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          }
                        }
                      }
                    },
                    "customers": {
                      "type": "array",
                      "maxItems": 500,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "plan"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "plan": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "description": "A plan key."
                          },
                          "since": {
                            "type": "string",
                            "description": "YYYY-MM-DD."
                          },
                          "price": {
                            "type": "string",
                            "description": "Only when it differs from the plan's list price."
                          },
                          "status": {
                            "enum": [
                              "active",
                              "ended"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          }
                        }
                      }
                    },
                    "vendors": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "for",
                          "cadence"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "for": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "amount": {
                            "type": "string",
                            "description": "Per cadence; omit when unknown, never substitute zero."
                          },
                          "currency": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "description": "Supported ISO currency; defaults to the report currency."
                          },
                          "status": {
                            "enum": [
                              "active",
                              "ended"
                            ]
                          },
                          "amount_basis": {
                            "enum": [
                              "tax_inclusive",
                              "tax_exclusive"
                            ]
                          },
                          "tax": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "description": "Observed tax terms; no tax or recoverability is inferred."
                          },
                          "cadence": {
                            "enum": [
                              "month",
                              "year",
                              "one_time",
                              "usage"
                            ]
                          },
                          "paid_by": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "account": {
                            "type": "integer",
                            "description": "Expense account code in the chart."
                          },
                          "function": {
                            "enum": [
                              "cost_of_revenue",
                              "research_and_development",
                              "sales_and_marketing",
                              "general_and_administrative",
                              "other"
                            ]
                          },
                          "drivers": {
                            "type": "array",
                            "maxItems": 20,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1000
                            },
                            "description": "The product actions that drive this vendor's cost (the service-call map)."
                          },
                          "source": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          }
                        }
                      }
                    }
                  },
                  "description": "The proposal: plans (key, name, cadence, optional price, currency, pricing), customers (name, plan key, since, price when not list), vendors (name, for, cadence, optional amount, currency, status, amount_basis, tax, account, function, drivers). Known amounts are minor-unit integer strings; omit unknown amounts."
                },
                "currency": {
                  "description": "Ledger currency (default: the functional currency active for the report period).",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "model"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "cap_table"
                },
                "as_of": {
                  "description": "The date (YYYY-MM-DD) or UTC timestamp (RFC 3339) the report is taken at. A date is a UTC day and includes everything on it; a timestamp includes everything before that moment.",
                  "type": "string",
                  "minLength": 1
                },
                "ledger_id": {
                  "description": "Native ledger ID.",
                  "type": "string",
                  "minLength": 1
                },
                "vesting_party_id": {
                  "description": "Include this party's declared vesting calendars and next scheduled dates; quantities remain scheduled, not vested. Supply as_of. Instrument totals remain business-wide.",
                  "type": "string",
                  "minLength": 1
                },
                "safe_party_id": {
                  "description": "Include this party's explicitly declared SAFE terms and post-money ownership estimates at the cap, separately from issued equity. Partial settlement or conversion leaves the estimate unknown.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind"
              ]
            }
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/reports

Operation: reports.list


```json
{
  "operationId": "reports.list",
  "description": "List all public report kinds, parameters and examples.",
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/reports/definitions

Operation: reports.definitions


```json
{
  "operationId": "reports.definitions",
  "description": "List the latest published custom report definitions, at most 100 per page.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## POST /v1/reports/definitions/run

Operation: reports.run_definition


```json
{
  "operationId": "reports.run_definition",
  "description": "Run a saved report with caller authority. Version pins immutable definition bytes; params sets the parameters the report declares, within their bounds. An answer may be reused for up to an hour while the books are unchanged: computed_at says when it was computed, and fresh runs it again.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "id"
          ],
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "version": {
              "type": "integer",
              "minimum": 1
            },
            "params": {
              "type": "object",
              "description": "Values for the report's declared parameters, by name: a month as YYYY-MM, a date as YYYY-MM-DD, a range as name_from and name_to, a choice's value, or a whole number. A value out of bounds falls back to the default and the answer says so.",
              "additionalProperties": {
                "type": [
                  "string",
                  "number"
                ]
              }
            },
            "fresh": {
              "type": "boolean"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/reports/definitions/guide

Operation: reports.format_guide


```json
{
  "operationId": "reports.format_guide",
  "description": "Read how a custom report is written before writing one: the block types and their fields, the parameter kinds, the money, chart, caption and layout rules, the limits, the monthly_metrics view for headline figures, and two worked definitions (a small report and an investor update) that pass the checks publishing applies. Then read the report schema, check, preview and publish.",
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/reports/definitions/check

Operation: reports.check_definition


```json
{
  "operationId": "reports.check_definition",
  "description": "Check a custom report definition with the checks publishing applies to it, without publishing: no version is made and nothing is recorded. A refusal names the block at fault. Publishing also refuses an archived id.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "definition"
          ],
          "properties": {
            "definition": {
              "type": "object",
              "description": "A custom report definition, as report_definitions.publish takes."
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/reports/definitions/preview

Operation: reports.preview_definition


```json
{
  "operationId": "reports.preview_definition",
  "description": "Run a custom report definition once without publishing it, with caller authority. It is held to what publishing accepts; nothing is recorded.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "definition"
          ],
          "properties": {
            "definition": {
              "type": "object",
              "description": "A custom report definition, as report_definitions.publish takes."
            },
            "params": {
              "type": "object",
              "description": "Values for the report's declared parameters, by name: a month as YYYY-MM, a date as YYYY-MM-DD, a range as name_from and name_to, a choice's value, or a whole number. A value out of bounds falls back to the default and the answer says so.",
              "additionalProperties": {
                "type": [
                  "string",
                  "number"
                ]
              }
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/reports/definitions/source

Operation: reports.definition_source


```json
{
  "operationId": "reports.definition_source",
  "description": "Read a published custom report's definition as it was stored: the latest version, or the one named. Publish it again with changes to make a new version.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "id"
          ],
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "version": {
              "type": "integer",
              "minimum": 1
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/reports/definitions/versions

Operation: reports.definition_versions


```json
{
  "operationId": "reports.definition_versions",
  "description": "List a custom report's versions, newest first, at most 100.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "id"
          ],
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^rpt_[0-9A-HJKMNP-TV-Z]{26}$"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## POST /v1/reports/query

Operation: reports.query


```json
{
  "operationId": "reports.query",
  "description": "Answer a question no built-in report covers with one read-only SQL query over the report schema. Returns typed columns and rows, with money (columns named *_minor) as integer strings and the head event the answer was read at. A result over the published row or size limit is refused, not cut short.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "sql"
          ],
          "properties": {
            "sql": {
              "type": "string",
              "description": "One SELECT, or WITH … SELECT, over the views reports.schema describes."
            },
            "params": {
              "type": "array",
              "description": "The values for the ? placeholders in sql, in order.",
              "items": {
                "type": [
                  "string",
                  "number",
                  "null"
                ]
              }
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/reports/schema

Operation: reports.schema


```json
{
  "operationId": "reports.schema",
  "description": "Describe the report schema: the views a query can read, their columns, the conventions and the limits on an answer.",
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/catalog

Operation: catalog.list


```json
{
  "operationId": "catalog.list",
  "description": "List permitted command names and descriptions.",
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/catalog/permissions

Operation: catalog.permissions


```json
{
  "operationId": "catalog.permissions",
  "description": "Read effective permission statements and resource constraints.",
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/export

Operation: export.get


```json
{
  "operationId": "export.get",
  "description": "Export the event history and document manifest with authenticated download URLs. Event paging remains deferred maintenance. The export is the raw content-addressed DAG-CBOR blocks and is not redacted: unlike the events read, ingestion.* payloads keep the captured delegation (authority) and each upload's tokenHash, so treat an export as sensitive.",
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/openapi.json

Operation: openapi.get


```json
{
  "operationId": "openapi.get",
  "description": "Generated OpenAPI for the current public catalog.",
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/documents/{id}/download

Operation: export.document


```json
{
  "operationId": "export.document",
  "description": "Download one original R2-backed document from a portable export. Requires export and history permission for this business.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Exact original bytes.",
      "content": {
        "application/octet-stream": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## GET /v1/catalog/commands/{name}

Operation: catalog.describe


```json
{
  "operationId": "catalog.describe",
  "description": "Describe a public command: input/result schemas, examples, the source-document kinds it accepts, the credential it needs and the input fields that must name a known principal.",
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "enum": [
          "accounts.archive",
          "accounts.register",
          "accounts.restore",
          "accounts.set_opening_balance",
          "accounts.update",
          "activities.archive",
          "activities.create",
          "activities.replace",
          "business.change_fiscal_year",
          "business.change_functional_currency",
          "business.change_legal_form",
          "business.change_legal_name",
          "business.deregister_sales_tax",
          "business.elect_accounting_framework",
          "business.incorporate",
          "business.record_formation_date",
          "business.register_sales_tax",
          "business.set_registration",
          "business.update",
          "card_statements.pay",
          "card_statements.record",
          "card_statements.reverse_payment",
          "card_statements.void",
          "categories.create",
          "concessions.assign",
          "concessions.create_offer",
          "concessions.reassign",
          "concessions.record_given",
          "concessions.reserve",
          "concessions.retire",
          "connections.accept",
          "connections.decline",
          "connections.end",
          "connections.request",
          "contracts.accept",
          "contracts.add_granted_credit",
          "contracts.add_usage_meter",
          "contracts.adopt",
          "contracts.amend",
          "contracts.cancel",
          "contracts.change_quantity",
          "contracts.create",
          "contracts.discard",
          "contracts.give_notice",
          "contracts.observe_usage",
          "contracts.offer",
          "contracts.reconcile_usage",
          "contracts.record",
          "contracts.renew",
          "contracts.resolve_usage_review",
          "contracts.reverse_economics",
          "contracts.terminate",
          "contracts.void",
          "contracts.withdraw_notice",
          "documents.receive",
          "documents.relate",
          "ingestions.agreement_proposal",
          "ingestions.amendment_proposal",
          "ingestions.attach_original",
          "ingestions.credit_proposal",
          "ingestions.invoice_candidates",
          "ingestions.receipt_proposal",
          "ingestions.reissue_upload",
          "ingestions.resolve",
          "ingestions.start",
          "ingestions.statement_matches",
          "journal.post",
          "journal.void",
          "members.grant",
          "members.revoke",
          "messages.send",
          "opportunities.link",
          "opportunities.lose",
          "opportunities.open",
          "opportunities.stage",
          "parties.add_contact",
          "parties.archive",
          "parties.create",
          "parties.rebind_vendor_identity",
          "parties.remove_contact",
          "parties.set_address",
          "parties.update",
          "payment_endpoints.register",
          "payment_endpoints.update",
          "payments.allocate",
          "payments.process",
          "payments.record",
          "payments.reverse",
          "payments.transfer",
          "payments.unallocate",
          "payroll.attribute_cost",
          "payroll.link_funding",
          "payroll.link_recorded_cost",
          "payroll.record_statement",
          "payroll.reverse_statement",
          "people.link_identity",
          "people.record_arrangement",
          "people.set_membership",
          "presentation_rate.record",
          "receipts.record",
          "report_definitions.archive",
          "report_definitions.pin",
          "report_definitions.publish",
          "report_definitions.unpin",
          "reporting_adjustment.post",
          "reporting_adjustment.void",
          "reporting_profile.select",
          "shared_views.create",
          "shared_views.revoke",
          "subscription.cancel_request",
          "subscription.revoke_cancellation",
          "tax_codes.create",
          "tax_codes.update",
          "templates.archive",
          "templates.create",
          "templates.replace"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "name",
              "description",
              "inputSchema",
              "resultSchema",
              "examples",
              "sourceDocumentKinds",
              "credential",
              "principalFields"
            ],
            "properties": {
              "name": {
                "type": "string",
                "enum": [
                  "accounts.archive",
                  "accounts.register",
                  "accounts.restore",
                  "accounts.set_opening_balance",
                  "accounts.update",
                  "activities.archive",
                  "activities.create",
                  "activities.replace",
                  "business.change_fiscal_year",
                  "business.change_functional_currency",
                  "business.change_legal_form",
                  "business.change_legal_name",
                  "business.deregister_sales_tax",
                  "business.elect_accounting_framework",
                  "business.incorporate",
                  "business.record_formation_date",
                  "business.register_sales_tax",
                  "business.set_registration",
                  "business.update",
                  "card_statements.pay",
                  "card_statements.record",
                  "card_statements.reverse_payment",
                  "card_statements.void",
                  "categories.create",
                  "concessions.assign",
                  "concessions.create_offer",
                  "concessions.reassign",
                  "concessions.record_given",
                  "concessions.reserve",
                  "concessions.retire",
                  "connections.accept",
                  "connections.decline",
                  "connections.end",
                  "connections.request",
                  "contracts.accept",
                  "contracts.add_granted_credit",
                  "contracts.add_usage_meter",
                  "contracts.adopt",
                  "contracts.amend",
                  "contracts.cancel",
                  "contracts.change_quantity",
                  "contracts.create",
                  "contracts.discard",
                  "contracts.give_notice",
                  "contracts.observe_usage",
                  "contracts.offer",
                  "contracts.reconcile_usage",
                  "contracts.record",
                  "contracts.renew",
                  "contracts.resolve_usage_review",
                  "contracts.reverse_economics",
                  "contracts.terminate",
                  "contracts.void",
                  "contracts.withdraw_notice",
                  "documents.receive",
                  "documents.relate",
                  "ingestions.agreement_proposal",
                  "ingestions.amendment_proposal",
                  "ingestions.attach_original",
                  "ingestions.credit_proposal",
                  "ingestions.invoice_candidates",
                  "ingestions.receipt_proposal",
                  "ingestions.reissue_upload",
                  "ingestions.resolve",
                  "ingestions.start",
                  "ingestions.statement_matches",
                  "journal.post",
                  "journal.void",
                  "members.grant",
                  "members.revoke",
                  "messages.send",
                  "opportunities.link",
                  "opportunities.lose",
                  "opportunities.open",
                  "opportunities.stage",
                  "parties.add_contact",
                  "parties.archive",
                  "parties.create",
                  "parties.rebind_vendor_identity",
                  "parties.remove_contact",
                  "parties.set_address",
                  "parties.update",
                  "payment_endpoints.register",
                  "payment_endpoints.update",
                  "payments.allocate",
                  "payments.process",
                  "payments.record",
                  "payments.reverse",
                  "payments.transfer",
                  "payments.unallocate",
                  "payroll.attribute_cost",
                  "payroll.link_funding",
                  "payroll.link_recorded_cost",
                  "payroll.record_statement",
                  "payroll.reverse_statement",
                  "people.link_identity",
                  "people.record_arrangement",
                  "people.set_membership",
                  "presentation_rate.record",
                  "receipts.record",
                  "report_definitions.archive",
                  "report_definitions.pin",
                  "report_definitions.publish",
                  "report_definitions.unpin",
                  "reporting_adjustment.post",
                  "reporting_adjustment.void",
                  "reporting_profile.select",
                  "shared_views.create",
                  "shared_views.revoke",
                  "subscription.cancel_request",
                  "subscription.revoke_cancellation",
                  "tax_codes.create",
                  "tax_codes.update",
                  "templates.archive",
                  "templates.create",
                  "templates.replace"
                ]
              },
              "description": {
                "type": "string"
              },
              "inputSchema": {
                "type": "object"
              },
              "resultSchema": {
                "type": "object"
              },
              "examples": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "input"
                  ],
                  "properties": {
                    "input": {
                      "type": "object"
                    }
                  }
                }
              },
              "sourceDocumentKinds": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Registered document kinds accepted as source_document_id; empty means none."
              },
              "credential": {
                "enum": [
                  "any",
                  "interactive",
                  "browser"
                ],
                "description": "interactive: refused (403) to a headless client credential; browser: refused (403) to every OAuth token, only the signed-in account pages may run it."
              },
              "principalFields": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Input fields that must name a principal this platform knows."
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## POST /v1/events/verify

Operation: events.verify


```json
{
  "operationId": "events.verify",
  "description": "Verify the ledger without appending commands. Takes no body. A result with ok false, empty diffs and a pending list means the core state matched and only derived contract-value coverage is still being filled in.",
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "X-Economico-Business",
      "in": "header",
      "required": true,
      "description": "Explicit business slug for this request; must be approved by the connection and token.",
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## GET /v1/vendor-catalog

Operation: vendor_catalog.find


```json
{
  "operationId": "vendor_catalog.find",
  "description": "Read the shared vendor catalog (find). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "domain",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "sender",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "descriptor",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "shelf",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "vendors",
          "standard-agreements",
          "patterns"
        ]
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "matches": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EntryMatch"
                }
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "matches",
              "cursor"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/vendors/{slug}

Operation: vendor_catalog.vendor


```json
{
  "operationId": "vendor_catalog.vendor",
  "description": "Read the shared vendor catalog (vendor). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Entry"
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/plans

Operation: vendor_catalog.galleryPlans


```json
{
  "operationId": "vendor_catalog.galleryPlans",
  "description": "Read the shared vendor catalog (galleryPlans). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "shelf",
      "in": "query",
      "required": true,
      "schema": {
        "enum": [
          "patterns"
        ]
      }
    },
    {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "group",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "blocks",
          "combinations"
        ]
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "plans": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/GalleryPlan"
                }
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "plans",
              "cursor"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/vendors/{slug}/plans

Operation: vendor_catalog.plans


```json
{
  "operationId": "vendor_catalog.plans",
  "description": "Read the shared vendor catalog (plans). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "include",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "not_offered"
        ]
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "plans": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PlanSummary"
                }
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "plans",
              "cursor"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/vendors/{slug}/plans/{plan}/history

Operation: vendor_catalog.history


```json
{
  "operationId": "vendor_catalog.history",
  "description": "Read the shared vendor catalog (history). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "plan",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "effectiveOn",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date"
      }
    },
    {
      "name": "from",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date"
      }
    },
    {
      "name": "to",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date"
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "change",
          "correction"
        ]
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "versions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/VersionSummary"
                }
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "oldest": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/VersionSummary"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "versions",
              "cursor"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/vendors/{slug}/agreements

Operation: vendor_catalog.agreements


```json
{
  "operationId": "vendor_catalog.agreements",
  "description": "Read the shared vendor catalog (agreements). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "doc",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "agreements": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AgreementVersion"
                }
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "agreements",
              "cursor"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/{cid}

Operation: vendor_catalog.get


```json
{
  "operationId": "vendor_catalog.get",
  "description": "Read the shared vendor catalog (get). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "description": "CIDv1 raw blake3 over exact stored bytes"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CatalogDocument"
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/{cid}/raw

Operation: vendor_catalog.raw


```json
{
  "operationId": "vendor_catalog.raw",
  "description": "Read the shared vendor catalog (raw). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "description": "CIDv1 raw blake3 over exact stored bytes"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "304": {
      "description": "Immutable bytes match If-None-Match"
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/{cid}/history

Operation: vendor_catalog.historyByCid


```json
{
  "operationId": "vendor_catalog.historyByCid",
  "description": "Read the shared vendor catalog (historyByCid). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "description": "CIDv1 raw blake3 over exact stored bytes"
      }
    },
    {
      "name": "effectiveOn",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date"
      }
    },
    {
      "name": "from",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date"
      }
    },
    {
      "name": "to",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date"
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "change",
          "correction"
        ]
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "versions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/VersionSummary"
                }
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "oldest": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/VersionSummary"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "versions",
              "cursor"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/supersession

Operation: vendor_catalog.supersession


```json
{
  "operationId": "vendor_catalog.supersession",
  "description": "Read the shared vendor catalog (supersession). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "cid",
      "in": "query",
      "required": true,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "minItems": 1,
        "maxItems": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Supersession"
                }
              }
            },
            "required": [
              "results"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/vendor-catalog/publications

Operation: vendor_catalog.publications


```json
{
  "operationId": "vendor_catalog.publications",
  "description": "Read the shared vendor catalog (publications). Requires a signed-in connection. Pages contain at most 100 rows and 1 MiB. Oversized expanded reads can be read as individual documents through /raw. Shares a per-principal budget of 120 reads per minute with MCP.",
  "parameters": [
    {
      "name": "publisher",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "published",
          "withdrawn"
        ]
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Catalog read",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "publications": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Publication"
                }
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "publications",
              "cursor"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid input or cursor",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Sign-in required",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown vendor, plan or document",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Catalog read budget exhausted; Retry-After: 60",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Catalog unavailable; Retry-After applies",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## GET /v1/businesses

Operation: businesses.list


```json
{
  "operationId": "businesses.list",
  "description": "List approved businesses and, with separate consent, current memberships. Set audience=public for the separate public directory. Select a business with --business for its operations.",
  "parameters": [
    {
      "name": "audience",
      "in": "query",
      "required": false,
      "schema": {
        "enum": [
          "accessible",
          "public"
        ],
        "type": "string"
      }
    },
    {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Canonical result; missing read objects are null. Money is in decimal integer strings.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "businesses",
              "cursor"
            ],
            "properties": {
              "businesses": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "slug"
                  ],
                  "properties": {
                    "slug": {
                      "type": "string"
                    },
                    "displayName": {
                      "type": "string"
                    }
                  }
                }
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Invalid envelope, query or domain input; also `missing_rates`, a foreign-currency command whose exchange rates the shared store could not supply (`details.missing_rates: [{ base, quote, date }]`, plus `details.refusal: { code, message }` when the command also refused), answered by stating an evidenced `exchangeRate`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid bearer token. Follow the WWW-Authenticate resource_metadata URL.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "WWW-Authenticate": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "402": {
      "description": "plan_required: the command needs a platform plan this business is not on (members beyond the owner and shared views need Founders or Startup), or the command would record more events than Solo's monthly allowance has left. The allowance refusal writes nothing (a retry may keep its idempotency key) and carries `details: { reason, included, used, requested, from, through }` (counts as decimal strings; `from`/`through` the current events period as UTC instants). `reason` `solo_limit`: Solo's allowance; tell the founder the limit and that it resets at `through`, then retry after `through`, or once they accept paid extra events or upgrade to a paid plan `details.choices` names (`founders` while the team fits Founders, `team` for Startup; each with its own offer for `platform_purchase`). `reason` `plan_cancelled`: Startup was cancelled, or Solo's extra events were turned off; the extra events so far were billed then, and until the plan ends at `endsAt` the business has only `allowed` events in each billing period (its included events, or up to the end of a started block the cancellation billed), with no further extra events; after that it is on Solo (`after` `solo`, for Startup); retry after `through` (the next period's included events) or after `endsAt`. Tell the founder; they can keep Startup (or the extra events) from the billing page once the extra events billed then are paid (for monthly Startup whose cancellation billed extra events, keeping it takes a new Startup agreement from the end; a first-year YC price cannot carry over, so that plan ends as scheduled), or choose it again once it has ended. Any new paid plan (Startup, extra events, a switch or that new agreement) starts only once every invoice from Economico is paid; until then the billing page says so. `reason` `usage_settled`: Startup or Solo's extra events were kept after a cancel; this period's usage was settled then, so retry after `through`. With `details.closesAt`, the business is set to close then (its owner approved closing it): tell the founder, and do not wait for `endsAt` or suggest keeping or upgrading the plan; the owner can stop the closing at /account/cancel until then. Reads, exports and payment setup stay available, and so does upgrading unless the business is set to close (`closesAt`).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Membership revoked, business unavailable for writes, or command credential requirements not met (browser-only commands refuse all OAuth tokens). `demo_business`: the business is a demo (`demo: true` on the business read: fictional, its owner's alone) and the command would reach someone else, send a message (support included, for now), publish it, take a plan or make it look like a real company, or the demo has recorded the 2,000 events it may record; tell the user, who can create their own business to do this.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Unknown route or missing required resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Method not supported.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Allow": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "408": {
      "description": "Request body transfer timed out (code `upload_timeout`): it took over 30 s, or paused over 5 s between chunks; retry the same request.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Domain or idempotency conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Length required (code `length_required`): a JSON body larger than 256 KiB must send Content-Length.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Payload too large (code `payload_too_large`): the request body exceeds the admitted byte limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "JSON body required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "Address rate budget exhausted. Wait for Retry-After seconds before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        }
      }
    },
    "500": {
      "description": "Internal failure.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Busy (code `busy`): the business is still receiving other document uploads or serving other large documents, and did not start this request. Retry the same request after Retry-After seconds.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## Components


```json
{
  "schemas": {
    "Error": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "hint": {
          "type": "string"
        },
        "details": {}
      }
    },
    "Publisher": {
      "type": "object",
      "properties": {
        "kind": {
          "enum": [
            "economico",
            "business"
          ]
        },
        "name": {
          "type": "string"
        },
        "did": {
          "type": "string"
        },
        "domainVerified": {
          "type": "boolean"
        },
        "domainClaim": {
          "type": "object"
        }
      },
      "required": [
        "kind",
        "name"
      ]
    },
    "EntryMatch": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "shelf": {
          "enum": [
            "vendors",
            "standard-agreements",
            "patterns"
          ]
        },
        "name": {
          "type": "string"
        },
        "publisher": {
          "$ref": "#/components/schemas/Publisher"
        },
        "matchedOn": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string"
            },
            "key": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "key"
          ]
        },
        "cid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        }
      },
      "required": [
        "slug",
        "shelf",
        "name",
        "publisher",
        "matchedOn",
        "cid"
      ]
    },
    "Entry": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "shelf": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "publisher": {
          "$ref": "#/components/schemas/Publisher"
        },
        "cid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "status": {
          "enum": [
            "listed",
            "withdrawn"
          ]
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "domains": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "entities": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "channels": {
          "type": "object"
        },
        "matching": {
          "type": "object"
        },
        "classificationHints": {
          "type": "object"
        }
      },
      "required": [
        "slug",
        "shelf",
        "name",
        "publisher",
        "cid",
        "status"
      ]
    },
    "PlanSummary": {
      "type": "object",
      "properties": {
        "planKey": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "channel": {
          "type": "string"
        },
        "cid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "effectiveFrom": {
          "type": "string",
          "format": "date"
        },
        "readOn": {
          "type": "string"
        },
        "status": {
          "enum": [
            "offered",
            "not_offered"
          ]
        },
        "evidence": {
          "enum": [
            "illustrative",
            "invoice-verified"
          ]
        },
        "templates": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "name"
            ]
          }
        },
        "minSchema": {
          "type": "integer"
        }
      },
      "required": [
        "planKey",
        "name",
        "cid",
        "effectiveFrom",
        "status",
        "evidence",
        "templates"
      ]
    },
    "GalleryPlan": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "planKey": {
          "type": "string"
        },
        "cid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "gallery": {
          "type": "object"
        }
      },
      "required": [
        "slug",
        "planKey",
        "cid",
        "gallery"
      ]
    },
    "VersionStatus": {
      "type": "object",
      "properties": {
        "state": {
          "enum": [
            "offered",
            "not_offered",
            "withdrawn"
          ]
        },
        "notOfferedSince": {
          "type": "string"
        },
        "withdrawn": {
          "type": "object"
        }
      },
      "required": [
        "state"
      ]
    },
    "Revision": {
      "type": "object",
      "properties": {
        "kind": {
          "enum": [
            "change",
            "correction"
          ]
        },
        "summary": {
          "type": "string"
        },
        "correctsFrom": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "summary"
      ]
    },
    "VersionSummary": {
      "type": "object",
      "properties": {
        "cid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "effectiveFrom": {
          "type": "string"
        },
        "readOn": {
          "type": "string"
        },
        "revision": {
          "$ref": "#/components/schemas/Revision"
        },
        "supersedes": {
          "type": [
            "string",
            "null"
          ]
        },
        "supersededBy": {
          "type": [
            "string",
            "null"
          ]
        },
        "current": {
          "type": "boolean"
        },
        "evidence": {
          "type": "string"
        },
        "status": {
          "$ref": "#/components/schemas/VersionStatus"
        }
      },
      "required": [
        "cid",
        "effectiveFrom",
        "status"
      ]
    },
    "Supersession": {
      "type": "object",
      "properties": {
        "cid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "known": {
          "type": "boolean"
        },
        "status": {
          "$ref": "#/components/schemas/VersionStatus"
        },
        "next": {
          "type": [
            "object",
            "null"
          ]
        },
        "current": {
          "type": [
            "object",
            "null"
          ]
        },
        "error": {
          "type": "object"
        }
      },
      "required": [
        "cid",
        "known"
      ]
    },
    "AgreementVersion": {
      "type": "object",
      "properties": {
        "cid": {
          "type": [
            "string",
            "null"
          ]
        },
        "recordCid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "doc": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "versionUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "label": {
          "type": "object"
        },
        "seenAt": {
          "type": "string"
        },
        "method": {
          "type": "object"
        },
        "history": {
          "type": "object"
        },
        "governs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "incorporates": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "rules": {
          "type": "object"
        },
        "changed": {
          "type": [
            "object",
            "null"
          ]
        },
        "revision": {
          "type": "object",
          "properties": {
            "kind": {
              "enum": [
                "change",
                "correction"
              ]
            },
            "summary": {
              "type": "string"
            },
            "effectiveFrom": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "summary",
            "effectiveFrom"
          ]
        },
        "supersedes": {
          "type": [
            "object",
            "string",
            "null"
          ]
        },
        "current": {
          "type": "boolean"
        }
      },
      "required": [
        "cid",
        "recordCid",
        "doc",
        "title",
        "url",
        "label",
        "seenAt",
        "method",
        "current"
      ]
    },
    "CatalogDocument": {
      "type": "object",
      "properties": {
        "cid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "kind": {
          "enum": [
            "entry",
            "vendor_plan",
            "source",
            "agreement"
          ]
        },
        "document": {
          "type": "object",
          "description": "Immutable for this cid. vendor_plan: vendor, publisher, planKey, name, effectiveFrom, readOn, revision, bundle and the cited source records; otherwise the parsed record."
        },
        "current": {
          "type": "object",
          "properties": {
            "status": {
              "$ref": "#/components/schemas/VersionStatus"
            },
            "evidence": {
              "enum": [
                "illustrative",
                "invoice-verified"
              ]
            },
            "supersession": {
              "$ref": "#/components/schemas/Supersession"
            },
            "agreements": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/AgreementVersion"
              }
            }
          },
          "required": [
            "status",
            "evidence",
            "supersession",
            "agreements"
          ],
          "description": "vendor_plan only, read fresh: sale state, evidence level (which a later real invoice replay can raise), supersession and the governing agreements in force."
        }
      },
      "required": [
        "cid",
        "kind",
        "document"
      ]
    },
    "Publication": {
      "type": "object",
      "properties": {
        "cid": {
          "type": "string",
          "description": "CIDv1 raw blake3 over exact stored bytes"
        },
        "name": {
          "type": "string"
        },
        "planKey": {
          "type": "string"
        },
        "publisher": {
          "$ref": "#/components/schemas/Publisher"
        },
        "slug": {
          "type": "string"
        },
        "domainVerified": {
          "type": "boolean"
        },
        "status": {
          "enum": [
            "published",
            "withdrawn"
          ]
        },
        "at": {
          "type": "string"
        }
      },
      "required": [
        "cid",
        "name",
        "planKey",
        "publisher",
        "slug",
        "domainVerified",
        "status",
        "at"
      ]
    }
  },
  "securitySchemes": {
    "bearerAuth": {
      "type": "http",
      "scheme": "bearer",
      "description": "Opaque OAuth or headless JWT token bound to https://economi.co/mcp."
    }
  }
}
```
