{
  "openapi": "3.1.0",
  "info": {
    "title": "InsightChain API",
    "version": "2.0.0",
    "description": "Every route an API key can call. Send the key as `Authorization: Bearer <key>`. Each operation names the key scope it needs (x-scope; execute includes read) and the module the organization must have (x-module). Every non-2xx answer is the Error object (error.type, error.code, error.message, error.param, request_id); every list operation answers the list object, and the ones that page (x-list paging: cursor) take `limit` and `cursor`, while a short list is answered whole (paging: none); every answer to an accepted API key carries the RateLimit-* headers, and every answer X-Request-ID. A path id marked as a record reference takes our UUID or `ext:<external_id>`, your own id. Versioning: additive changes ship at any time; anything else is a new route or /v2, and a deprecated route keeps answering for at least six months. The older paths (one more segment after /v1) were deprecated on 2026-11-21 and answer until at least 2027-06-30, with Deprecation, Sunset and Link headers. Changes are listed at /docs/changelog.",
    "contact": {
      "name": "InsightChain",
      "url": "https://insightchain.ai/docs"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://insightchain.ai/terms"
    }
  },
  "servers": [
    {
      "url": "https://api.insightchain.ai"
    }
  ],
  "tags": [
    {
      "name": "alerts",
      "description": "Alerts raised for your organization"
    },
    {
      "name": "api_keys",
      "description": "API keys: list, create, rotate with an overlap, revoke and change scopes (the `keys` scope)"
    },
    {
      "name": "compliance",
      "description": "Product compliance: admissibility verdicts, item attributes, certificates and the compliance gate"
    },
    {
      "name": "connections",
      "description": "ERP connections and their syncs"
    },
    {
      "name": "customs_documents",
      "description": "Commercial invoices and packing lists"
    },
    {
      "name": "denied_party_screenings",
      "description": "Screening a person or company against denied-party lists"
    },
    {
      "name": "disruptions",
      "description": "Disruption events and your exposure to them"
    },
    {
      "name": "explanations",
      "description": "The evidence behind a recommendation"
    },
    {
      "name": "forecast_checks",
      "description": "Your forecast against our baseline"
    },
    {
      "name": "import_taxes",
      "description": "Import VAT and GST"
    },
    {
      "name": "ingest",
      "description": "Pushing your data in"
    },
    {
      "name": "inventory",
      "description": "Demand, forecasts, replenishment and stock analytics"
    },
    {
      "name": "landed_costs",
      "description": "Total landed cost of a shipment"
    },
    {
      "name": "location_risks",
      "description": "Sanctions and trade-compliance risk of a country"
    },
    {
      "name": "mcp",
      "description": "The Model Context Protocol server for agents"
    },
    {
      "name": "orders",
      "description": "Orders in the approval loop"
    },
    {
      "name": "parcel_assessments",
      "description": "What each parcel of a batch into the UAE, Saudi Arabia or Egypt will be charged and what it needs to enter"
    },
    {
      "name": "passports",
      "description": "Digital product passports"
    },
    {
      "name": "recalls",
      "description": "Product recall notices matched to your items"
    },
    {
      "name": "recommendations",
      "description": "Recommendations from every agent"
    },
    {
      "name": "request_logs",
      "description": "The log of the calls made with your keys (30 days)"
    },
    {
      "name": "sync_runs",
      "description": "Sync runs of your connections"
    },
    {
      "name": "tariff_checks",
      "description": "Duty for a product from an origin into a destination"
    },
    {
      "name": "trade",
      "description": "Tariff impact and trade reference data"
    },
    {
      "name": "usage",
      "description": "Requests against each key's daily quota"
    },
    {
      "name": "webhooks",
      "description": "Webhook endpoints for alerts, their delivery log and redelivery"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An InsightChain API key: ic_live_... for your organization, ic_test_... for its sandbox"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "The body of every non-2xx answer",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "permission_error",
                  "rate_limit_error",
                  "api_error"
                ]
              },
              "code": {
                "type": "string",
                "description": "Stable machine-readable code, e.g. parameter_invalid, scope_missing, rate_limit_exceeded. Every code is listed at /docs/errors"
              },
              "message": {
                "type": "string",
                "description": "For people; what `error` used to be as a plain string"
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The parameter the error is about, when there is one"
              },
              "doc_url": {
                "type": "string",
                "description": "Where the code is documented"
              }
            },
            "required": [
              "type",
              "code",
              "message",
              "param",
              "doc_url"
            ]
          },
          "request_id": {
            "type": "string"
          },
          "details": {
            "type": "array",
            "items": {},
            "description": "On a 400 for input with several problems: one entry per problem, a sentence or an object with `field` and `message`"
          },
          "limit": {
            "type": "integer",
            "description": "On a 429: the limit that was reached"
          },
          "code": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated: use error.code"
          },
          "field": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated: use error.param"
          }
        },
        "required": [
          "error",
          "request_id"
        ],
        "additionalProperties": true
      },
      "Alert": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "description": "What raised it, for example recommendation, disruption, recall, connector or tariff_brief. The event of its webhook delivery is insightchain.<kind>"
          },
          "severity": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "acknowledged",
              "resolved"
            ]
          },
          "title": {
            "type": "string"
          },
          "payload": {
            "type": "object",
            "additionalProperties": true,
            "description": "The alert's details; the fields depend on kind"
          },
          "assignee": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "acknowledged_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "acknowledged_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "resolved_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "resolved_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "delivered_to": {
            "type": "integer",
            "description": "Webhook endpoints the alert has been delivered to"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "severity",
          "status",
          "title",
          "payload",
          "assignee",
          "acknowledged_by",
          "acknowledged_at",
          "resolved_by",
          "resolved_at",
          "delivered_to",
          "created_at"
        ]
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "key",
              "oauth"
            ],
            "description": "key: an API key. oauth: an app connected with your account (listed for a signed-in person only)"
          },
          "environment": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ],
            "description": "test: a key of your sandbox (ic_test_...)"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "ingest",
                "execute",
                "approve",
                "keys"
              ]
            }
          },
          "active": {
            "type": "boolean"
          },
          "daily_limit": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Requests a day"
          },
          "requests_today": {
            "type": "integer",
            "description": "Requests counted on last_reset_date"
          },
          "last_reset_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the key was last used, to the minute"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the key stops working; null: it does not expire"
          },
          "key_hint": {
            "type": [
              "string",
              "null"
            ],
            "description": "The key's prefix and last four characters, to tell keys apart; null for a key made before hints were kept"
          },
          "rotated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "previous_secret_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "After a rotation with an overlap: until when the previous secret still works"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "owner_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "org_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "environment",
          "scopes",
          "active",
          "daily_limit",
          "requests_today",
          "last_reset_date",
          "last_used_at",
          "expires_at",
          "key_hint",
          "rotated_at",
          "previous_secret_expires_at",
          "created_at",
          "created_by",
          "owner_email",
          "org_id"
        ]
      },
      "ClassificationCandidate": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Digits only"
          },
          "code_display": {
            "type": "string",
            "description": "As the schedule prints it"
          },
          "description": {
            "type": "string",
            "description": "The schedule's words for the line, from its heading down"
          },
          "duty_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line's general duty rate as the schedule prints it"
          },
          "declarable": {
            "type": "boolean",
            "description": "Whether a declaration can name this line (nothing sits under it)"
          },
          "source": {
            "type": "string",
            "enum": [
              "own_item",
              "mapping",
              "schedule"
            ],
            "description": "own_item: one of your items with a close description already carries this code. mapping: a reviewed mapping for a close description. schedule: the schedule's own text"
          },
          "also_from": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "own_item",
                "mapping",
                "schedule"
              ]
            },
            "description": "Other sources that proposed the same code"
          },
          "score": {
            "type": "number",
            "description": "0 to 1: how close, within its source"
          },
          "evidence": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "What the candidate rests on: the item of yours it matched (`item`, `item_description`, `similar_items_with_this_code`), the mapping (`mapping_description`), or the words of your description the line carries (`matched_words`)"
          }
        },
        "required": [
          "code",
          "code_display",
          "description",
          "duty_rate",
          "declarable",
          "source",
          "also_from",
          "score",
          "evidence"
        ]
      },
      "ClassificationItem": {
        "type": "object",
        "properties": {
          "item_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string",
            "description": "The item's id in your own system"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "hs_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The code on the item, as you sent it"
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The same code, digits only: what is compared with the schedule"
          },
          "state": {
            "type": "string",
            "enum": [
              "valid",
              "too_general",
              "not_listed",
              "retired",
              "missing"
            ],
            "description": "valid: a line of the schedule a declaration can name. too_general: a line with lines under it. not_listed: the schedule has never had this code. retired: a line of an earlier edition, no longer in the schedule. missing: the item has no code"
          },
          "line_description": {
            "type": [
              "string",
              "null"
            ],
            "description": "The schedule's words for the line, from its heading down; null when the code is not a line"
          },
          "mfn_display": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line's general duty rate as the schedule prints it"
          },
          "lines_under": {
            "type": [
              "integer",
              "null"
            ],
            "description": "too_general only: how many declarable lines sit under the code"
          },
          "same_rate": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "too_general only: whether every line under the code carries the same rate"
          },
          "retired_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "retired only: when the line was found gone from the schedule"
          },
          "retired_edition": {
            "type": [
              "string",
              "null"
            ],
            "description": "retired only: the edition that no longer has it"
          },
          "nearest_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "not_listed only: the longest line above the code that does exist"
          }
        },
        "required": [
          "item_id",
          "external_id",
          "description",
          "category",
          "hs_code",
          "code",
          "state",
          "line_description",
          "mfn_display",
          "lines_under",
          "same_rate",
          "retired_at",
          "retired_edition",
          "nearest_code"
        ]
      },
      "ComplianceReason": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "rule"
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "blocked",
                  "conditional"
                ]
              },
              "rule_id": {
                "type": "string",
                "format": "uuid"
              },
              "rule_ref": {
                "type": "string",
                "description": "An opaque reference to the rule, the same for the same rule"
              },
              "rule_type": {
                "type": "string",
                "enum": [
                  "prohibition",
                  "licence",
                  "conformity",
                  "technical_fit"
                ]
              },
              "requirement": {
                "type": "string",
                "description": "What the rule requires"
              },
              "satisfied_by": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true,
                "description": "What satisfies the rule, as the rule states it (document kinds, standards)"
              },
              "authority": {
                "type": "string",
                "description": "The authority behind the rule"
              },
              "source_url": {
                "type": "string"
              },
              "source_read_on": {
                "type": "string",
                "format": "date",
                "description": "When the rule's source was last read"
              },
              "origins": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "The origins the rule was applied for; null when it applies whatever the origin"
              },
              "applies_when": {
                "type": "string",
                "description": "The fact a person must judge for the rule to apply"
              },
              "certificate": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "satisfied",
                      "not_satisfied",
                      "expired",
                      "not_specified"
                    ],
                    "description": "not_specified: the rule names no document kind or standard"
                  },
                  "documents": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "certificate_of_conformity",
                        "declaration_of_conformity",
                        "test_report",
                        "type_approval",
                        "children_product_certificate",
                        "general_certificate_of_conformity",
                        "import_licence",
                        "permit",
                        "registration",
                        "other"
                      ]
                    },
                    "description": "The document kinds the rule asks for"
                  },
                  "standards": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "certificate_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  },
                  "certificate_valid_from": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "certificate_valid_until": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "check": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "valid",
                      "not_yet_valid",
                      "expired",
                      "missing",
                      null
                    ]
                  }
                },
                "required": [
                  "status",
                  "documents",
                  "standards",
                  "certificate_id",
                  "certificate_valid_from",
                  "certificate_valid_until",
                  "check"
                ],
                "description": "Conformity and licence rules: whether one of the item's certificates satisfies the rule today"
              }
            },
            "required": [
              "kind",
              "verdict",
              "rule_id",
              "rule_ref",
              "rule_type",
              "requirement",
              "satisfied_by",
              "authority",
              "source_url",
              "source_read_on",
              "origins"
            ],
            "description": "A rule on file that applies to the item"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "official_measure"
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "blocked",
                  "conditional"
                ]
              },
              "authority": {
                "type": "string",
                "enum": [
                  "UK tariff",
                  "EU tariff"
                ],
                "description": "The official tariff the measure is in"
              },
              "measure": {
                "type": "string",
                "description": "The measure, in the tariff's own words"
              },
              "measure_type_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "measure_kind": {
                "type": "string",
                "enum": [
                  "prohibition",
                  "control"
                ]
              },
              "area": {
                "type": "string",
                "description": "The geographical area the measure names"
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "origin": {
                "type": "string",
                "description": "The origin the measure applied to"
              },
              "resolved_code": {
                "type": "string",
                "description": "The tariff line (or subheading) read"
              },
              "source_url": {
                "type": "string"
              },
              "as_of": {
                "type": "string",
                "format": "date"
              },
              "subheading": {
                "type": "string",
                "description": "Present when the tariff was read by six-digit subheading because the code is not one of its lines"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The tariff lines read (or, on a measure, the lines that carry it)"
              },
              "lines_total": {
                "type": "integer",
                "description": "Lines under the subheading"
              },
              "applies_to": {
                "type": "string",
                "enum": [
                  "every_line",
                  "some_lines"
                ],
                "description": "some_lines: the measure may apply; the item's own line decides"
              },
              "documents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": "The document code as declared, e.g. C400, Y900"
                    },
                    "description": {
                      "type": "string"
                    },
                    "waiver": {
                      "type": "boolean",
                      "description": "true when the document is a statement that the goods are not of the kind the measure covers (no licence needed)"
                    },
                    "groups": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The measure's condition groups that offer this document"
                    }
                  },
                  "required": [
                    "code",
                    "description",
                    "waiver"
                  ]
                },
                "description": "The documents the measure's conditions name"
              },
              "condition": {
                "type": "string",
                "description": "The measure's conditions quoted in one line"
              },
              "code_basis": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "The code the tariff was read for, digits only"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "item",
                      "commodity_code_gb",
                      "commodity_code_eu"
                    ],
                    "description": "item: the commodity code of the item, or the one sent with the request; else the confirmed destination code attribute"
                  },
                  "confirmed_by": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  },
                  "confirmed_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "attribute_source": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "code",
                  "source"
                ],
                "description": "The code the tariff was read for and where it came from"
              },
              "code_needed": {
                "type": "object",
                "properties": {
                  "attribute": {
                    "type": "string",
                    "enum": [
                      "commodity_code_gb",
                      "commodity_code_eu"
                    ]
                  },
                  "fix": {
                    "type": "string"
                  }
                },
                "required": [
                  "attribute",
                  "fix"
                ],
                "description": "The destination commodity code that would settle the answer"
              },
              "waiver": {
                "type": "object",
                "properties": {
                  "document_code": {
                    "type": "string"
                  },
                  "attribute": {
                    "type": "string",
                    "enum": [
                      "gtin",
                      "brand",
                      "model",
                      "product_class",
                      "plug_type",
                      "voltage_range",
                      "frequency_hz",
                      "radio",
                      "mains_powered",
                      "battery_chemistry",
                      "age_grade",
                      "contains_seal_products",
                      "contains_cat_dog_fur",
                      "contains_cites_species",
                      "is_torture_repression_goods",
                      "is_waste",
                      "contains_ivory",
                      "organic",
                      "commodity_code_gb",
                      "commodity_code_eu"
                    ]
                  },
                  "statement": {
                    "type": "string",
                    "description": "What the waiver states about the goods"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "not_confirmed",
                      "contains"
                    ],
                    "description": "not_confirmed: the attribute has no confirmed value; contains: it is confirmed true, so the control's licence or certificate is needed"
                  },
                  "fix": {
                    "type": "string"
                  }
                },
                "required": [
                  "document_code",
                  "attribute",
                  "statement",
                  "status",
                  "fix"
                ],
                "description": "A control that confirming the attribute as false would waive, not waived for this item"
              },
              "waiver_not_every_group": {
                "type": "object",
                "properties": {
                  "document_code": {
                    "type": "string"
                  },
                  "attribute": {
                    "type": "string",
                    "enum": [
                      "gtin",
                      "brand",
                      "model",
                      "product_class",
                      "plug_type",
                      "voltage_range",
                      "frequency_hz",
                      "radio",
                      "mains_powered",
                      "battery_chemistry",
                      "age_grade",
                      "contains_seal_products",
                      "contains_cat_dog_fur",
                      "contains_cites_species",
                      "is_torture_repression_goods",
                      "is_waste",
                      "contains_ivory",
                      "organic",
                      "commodity_code_gb",
                      "commodity_code_eu"
                    ]
                  },
                  "condition_groups": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "groups_missing": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "document_code",
                  "attribute",
                  "condition_groups",
                  "groups_missing",
                  "message"
                ],
                "description": "A waiver the conditions list in only some of their groups: it cannot satisfy the control on its own"
              }
            },
            "required": [
              "kind",
              "verdict",
              "authority",
              "measure",
              "measure_type_id",
              "measure_kind",
              "area",
              "detail",
              "origin",
              "resolved_code",
              "source_url",
              "as_of"
            ],
            "description": "An import prohibition or control the official tariff lists for the code and origin"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "measure_waived"
              },
              "verdict": {
                "const": "clear"
              },
              "authority": {
                "type": "string",
                "enum": [
                  "UK tariff",
                  "EU tariff"
                ],
                "description": "The official tariff the measure is in"
              },
              "measure": {
                "type": "string"
              },
              "measure_type_id": {
                "type": "string"
              },
              "area": {
                "type": "string"
              },
              "origin": {
                "type": "string"
              },
              "resolved_code": {
                "type": "string"
              },
              "source_url": {
                "type": "string"
              },
              "as_of": {
                "type": "string",
                "format": "date"
              },
              "document_code": {
                "type": "string",
                "description": "The waiver document the tariff's conditions list"
              },
              "attribute": {
                "type": "string",
                "enum": [
                  "gtin",
                  "brand",
                  "model",
                  "product_class",
                  "plug_type",
                  "voltage_range",
                  "frequency_hz",
                  "radio",
                  "mains_powered",
                  "battery_chemistry",
                  "age_grade",
                  "contains_seal_products",
                  "contains_cat_dog_fur",
                  "contains_cites_species",
                  "is_torture_repression_goods",
                  "is_waste",
                  "contains_ivory",
                  "organic",
                  "commodity_code_gb",
                  "commodity_code_eu"
                ]
              },
              "value": {
                "const": false
              },
              "statement": {
                "type": "string",
                "description": "What the waiver states about the goods"
              },
              "confirmed_by": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid",
                "description": "Who confirmed the attribute; null for an attribute stated in POST /check"
              },
              "confirmed_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "attribute_source": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code_basis": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "The code the tariff was read for, digits only"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "item",
                      "commodity_code_gb",
                      "commodity_code_eu"
                    ],
                    "description": "item: the commodity code of the item, or the one sent with the request; else the confirmed destination code attribute"
                  },
                  "confirmed_by": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  },
                  "confirmed_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "attribute_source": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "code",
                  "source"
                ],
                "description": "The code the tariff was read for and where it came from"
              },
              "subheading": {
                "type": "string",
                "description": "Present when the tariff was read by six-digit subheading because the code is not one of its lines"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The tariff lines read (or, on a measure, the lines that carry it)"
              },
              "lines_total": {
                "type": "integer",
                "description": "Lines under the subheading"
              },
              "applies_to": {
                "type": "string",
                "enum": [
                  "every_line",
                  "some_lines"
                ],
                "description": "some_lines: the measure may apply; the item's own line decides"
              }
            },
            "required": [
              "kind",
              "verdict",
              "authority",
              "measure",
              "measure_type_id",
              "area",
              "origin",
              "resolved_code",
              "source_url",
              "as_of",
              "document_code",
              "attribute",
              "value",
              "statement",
              "confirmed_by",
              "confirmed_at",
              "attribute_source"
            ],
            "description": "An import control satisfied by its waiver: the item's confirmed attribute states what the waiver states"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "checked"
              },
              "authority": {
                "type": "string",
                "enum": [
                  "UK tariff",
                  "EU tariff"
                ],
                "description": "The official tariff the measure is in"
              },
              "origin": {
                "type": "string"
              },
              "resolved_code": {
                "type": "string"
              },
              "source_url": {
                "type": "string"
              },
              "as_of": {
                "type": "string",
                "format": "date"
              },
              "subheading": {
                "type": "string",
                "description": "Present when the tariff was read by six-digit subheading because the code is not one of its lines"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The tariff lines read (or, on a measure, the lines that carry it)"
              },
              "code_basis": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "The code the tariff was read for, digits only"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "item",
                      "commodity_code_gb",
                      "commodity_code_eu"
                    ],
                    "description": "item: the commodity code of the item, or the one sent with the request; else the confirmed destination code attribute"
                  },
                  "confirmed_by": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  },
                  "confirmed_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "attribute_source": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "code",
                  "source"
                ],
                "description": "The code the tariff was read for and where it came from"
              }
            },
            "required": [
              "kind",
              "authority",
              "origin",
              "resolved_code",
              "source_url",
              "as_of"
            ],
            "description": "Evidence for clear: the official tariff was read for this origin and lists no prohibition or control"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "coverage"
              },
              "review_by": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "dimensions": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "import_measures",
                    "conformity",
                    "technical_fit"
                  ]
                }
              }
            },
            "required": [
              "kind",
              "review_by",
              "dimensions"
            ],
            "description": "Evidence for scope: reviewed rules cover the code for these dimensions"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "unknown"
              },
              "code": {
                "type": "string",
                "enum": [
                  "commodity_code_not_found",
                  "commodity_code_too_general",
                  "destination_code_mismatch",
                  "destination_code_not_found",
                  "intra_eu_movement",
                  "invalid_commodity_code",
                  "invalid_destination",
                  "invalid_rule_conditions",
                  "lookup_failed",
                  "no_commodity_code",
                  "no_origin",
                  "not_covered",
                  "rule_needs_attributes",
                  "rule_needs_review",
                  "stale_rule_set",
                  "unreviewed_rule_set",
                  "unsupported_destination"
                ]
              },
              "message": {
                "type": "string"
              },
              "fix": {
                "type": "string",
                "description": "What would settle it"
              },
              "origin": {
                "type": "string"
              },
              "rule_id": {
                "type": "string",
                "format": "uuid"
              },
              "rule_ref": {
                "type": "string",
                "description": "An opaque reference to the rule, the same for the same rule"
              },
              "would_be": {
                "type": "string",
                "enum": [
                  "blocked",
                  "conditional"
                ],
                "description": "For a rule that could not count: what it would have said"
              },
              "source_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "gtin",
                    "brand",
                    "model",
                    "product_class",
                    "plug_type",
                    "voltage_range",
                    "frequency_hz",
                    "radio",
                    "mains_powered",
                    "battery_chemistry",
                    "age_grade",
                    "contains_seal_products",
                    "contains_cat_dog_fur",
                    "contains_cites_species",
                    "is_torture_repression_goods",
                    "is_waste",
                    "contains_ivory",
                    "organic",
                    "commodity_code_gb",
                    "commodity_code_eu"
                  ]
                },
                "description": "rule_needs_attributes: the attributes the item needs confirmed"
              },
              "applies_when": {
                "type": "string",
                "description": "rule_needs_review: the fact a person must judge"
              },
              "detail": {
                "type": "string",
                "description": "This finding in particular (message is the code's general one)"
              },
              "read_on": {
                "type": "string",
                "format": "date",
                "description": "lookup_failed on an old read: the day it was read"
              },
              "subheading": {
                "type": "string"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "lines_total": {
                "type": "integer"
              },
              "measure": {
                "type": "string"
              },
              "code_basis": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "The code the tariff was read for, digits only"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "item",
                      "commodity_code_gb",
                      "commodity_code_eu"
                    ],
                    "description": "item: the commodity code of the item, or the one sent with the request; else the confirmed destination code attribute"
                  },
                  "confirmed_by": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  },
                  "confirmed_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "attribute_source": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "code",
                  "source"
                ],
                "description": "The code the tariff was read for and where it came from"
              },
              "code_needed": {
                "type": "object",
                "properties": {
                  "attribute": {
                    "type": "string",
                    "enum": [
                      "commodity_code_gb",
                      "commodity_code_eu"
                    ]
                  },
                  "fix": {
                    "type": "string"
                  }
                },
                "required": [
                  "attribute",
                  "fix"
                ],
                "description": "The destination commodity code that would settle the answer"
              }
            },
            "required": [
              "kind",
              "code",
              "message",
              "fix"
            ],
            "description": "Something that could not be determined, with its fix"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "technical_fit"
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "clear",
                  "conditional"
                ]
              },
              "result": {
                "type": "string",
                "enum": [
                  "match",
                  "mismatch",
                  "not_applicable"
                ]
              },
              "country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2"
              },
              "mismatches": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "attribute": {
                      "type": "string",
                      "enum": [
                        "plug_type",
                        "voltage_range",
                        "frequency_hz"
                      ]
                    },
                    "item": {
                      "description": "The item's value of the attribute (a plug letter, a voltage range, a list of frequencies)"
                    },
                    "destination": {
                      "description": "The destination's values (plug letters, voltages, frequencies)"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "attribute",
                    "item",
                    "destination",
                    "message"
                  ]
                }
              },
              "source_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_read_on": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "review_by": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              }
            },
            "required": [
              "kind",
              "verdict",
              "result",
              "country",
              "mismatches",
              "source_url",
              "source_read_on",
              "review_by"
            ],
            "description": "The item's plug, voltage and frequency against the destination's mains"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "not_checked"
              },
              "dimension": {
                "const": "technical_fit"
              },
              "code": {
                "type": "string",
                "enum": [
                  "no_technical_profile",
                  "stale_technical_profile",
                  "technical_fit_needs_attributes"
                ]
              },
              "message": {
                "type": "string"
              },
              "fix": {
                "type": "string"
              },
              "country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2"
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "gtin",
                    "brand",
                    "model",
                    "product_class",
                    "plug_type",
                    "voltage_range",
                    "frequency_hz",
                    "radio",
                    "mains_powered",
                    "battery_chemistry",
                    "age_grade",
                    "contains_seal_products",
                    "contains_cat_dog_fur",
                    "contains_cites_species",
                    "is_torture_repression_goods",
                    "is_waste",
                    "contains_ivory",
                    "organic",
                    "commodity_code_gb",
                    "commodity_code_eu"
                  ]
                },
                "description": "technical_fit_needs_attributes: the attributes to confirm"
              },
              "source_url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "kind",
              "dimension",
              "code",
              "message",
              "fix",
              "country"
            ],
            "description": "A dimension that was not checked; it is left out of scope and the verdict is otherwise unchanged"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "upcoming_rule"
              },
              "would_be": {
                "type": "string",
                "enum": [
                  "blocked",
                  "conditional"
                ],
                "description": "What the rule will say from `effective_from`"
              },
              "effective_from": {
                "type": "string",
                "format": "date",
                "description": "The first day the rule counts"
              },
              "match": {
                "type": "string",
                "enum": [
                  "applies",
                  "possible"
                ],
                "description": "possible: the item's code is less specific than the rule's lines, so the item's own line decides"
              },
              "rule_id": {
                "type": "string",
                "format": "uuid"
              },
              "rule_ref": {
                "type": "string",
                "description": "An opaque reference to the rule, the same for the same rule"
              },
              "rule_type": {
                "type": "string",
                "enum": [
                  "prohibition",
                  "licence",
                  "conformity",
                  "technical_fit"
                ]
              },
              "requirement": {
                "type": "string",
                "description": "What the rule will require"
              },
              "satisfied_by": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true,
                "description": "What satisfies the rule, as the rule states it (document kinds, standards)"
              },
              "authority": {
                "type": "string",
                "description": "The authority behind the rule"
              },
              "source_url": {
                "type": "string"
              },
              "source_read_on": {
                "type": "string",
                "format": "date",
                "description": "When the rule's source was last read"
              }
            },
            "required": [
              "kind",
              "would_be",
              "effective_from",
              "match",
              "rule_id",
              "rule_ref",
              "rule_type",
              "requirement",
              "satisfied_by",
              "authority",
              "source_url",
              "source_read_on"
            ],
            "description": "A rule that is not in force yet and will apply to the item, or may; it does not change the verdict"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "code_shortened"
              },
              "item_code": {
                "type": "string",
                "description": "The item's own code, digits only (11 or 12 digits: a Gulf tariff line)"
              },
              "code": {
                "type": "string",
                "description": "The six digits the answer rests on: the international subheading"
              },
              "detail": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "item_code",
              "code",
              "detail"
            ],
            "description": "The item's code is a Gulf tariff line and the destination is not Saudi Arabia or the UAE: the answer rests on its first six digits; it does not change the verdict by itself"
          }
        ],
        "description": "One reason behind a verdict; `kind` says which fields it carries"
      },
      "ComplianceVerdict": {
        "type": "object",
        "properties": {
          "item": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "external_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "external_id",
              "description"
            ]
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2"
          },
          "computed": {
            "const": true
          },
          "verdict": {
            "type": "string",
            "enum": [
              "blocked",
              "conditional",
              "clear",
              "unknown"
            ]
          },
          "scope": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "import_measures",
                "conformity",
                "technical_fit"
              ]
            },
            "description": "The dimensions the answer is complete for. A clear verdict says nothing beyond them"
          },
          "unknown_codes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "commodity_code_not_found",
                "commodity_code_too_general",
                "destination_code_mismatch",
                "destination_code_not_found",
                "intra_eu_movement",
                "invalid_commodity_code",
                "invalid_destination",
                "invalid_rule_conditions",
                "lookup_failed",
                "no_commodity_code",
                "no_origin",
                "not_covered",
                "rule_needs_attributes",
                "rule_needs_review",
                "stale_rule_set",
                "unreviewed_rule_set",
                "unsupported_destination"
              ]
            },
            "description": "Every unknown found; never empty when the verdict is unknown"
          },
          "reasons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComplianceReason"
            }
          },
          "unknown_causes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "coverage",
                "item_data",
                "review",
                "source"
              ]
            },
            "description": "Why the unknowns: coverage (nothing in your data changes it), item_data (the item's data can fix it), review (a person must judge a fact), source (an official tariff could not be read)"
          },
          "rule_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The rules behind the answer"
          },
          "rule_set_version": {
            "type": "string",
            "description": "An opaque version of what the verdict was computed from. Compare it for equality: it changes when the rules or the tariff reads behind the verdict change"
          },
          "commodity_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The item's commodity code the verdict was computed for, digits only"
          },
          "origins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The origin countries the verdict was computed for"
          },
          "origin_basis": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "item",
              "suppliers",
              "none",
              null
            ],
            "description": "Where the origins came from: item (the item's own country of origin, which wins), suppliers (the countries of the suppliers on its purchase orders), none; null on a verdict computed before this was recorded"
          },
          "computed_at": {
            "type": "string",
            "format": "date-time"
          },
          "stale": {
            "type": "boolean",
            "description": "true when the verdict may no longer describe the item"
          },
          "stale_reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "computed_over_48h_ago",
                "commodity_code_changed"
              ]
            }
          }
        },
        "required": [
          "item",
          "country",
          "computed",
          "verdict",
          "scope",
          "unknown_codes",
          "reasons",
          "unknown_causes",
          "rule_ids",
          "rule_set_version",
          "commodity_code",
          "origins",
          "computed_at",
          "stale",
          "stale_reasons"
        ]
      },
      "CountryRiskProfile": {
        "type": "object",
        "properties": {
          "country_code": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "country_name": {
            "type": "string"
          },
          "risk_level": {
            "type": "string",
            "enum": [
              "LOW",
              "MEDIUM",
              "ELEVATED",
              "HIGH",
              "CRITICAL",
              "BLOCKED"
            ]
          },
          "sanctioned": {
            "type": "boolean",
            "description": "true when trade with the country itself is restricted (a comprehensive or partial embargo)"
          },
          "embargo_type": {
            "type": "string",
            "enum": [
              "none",
              "targeted",
              "partial",
              "comprehensive"
            ]
          },
          "sanctions_programs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The programs and regimes by name, prefixed with who imposes them"
          },
          "risk_factors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "One line per fact that set the level"
          },
          "fatf_status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "blacklist",
              "greylist",
              "clear",
              null
            ]
          },
          "fatf_list_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "cpi_tier": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "very_low",
              "low",
              "medium",
              "high",
              "very_high",
              null
            ],
            "description": "Tier of the country's corruption perceptions score; very_low is the most corrupt"
          },
          "ear_group": {
            "type": [
              "string",
              "null"
            ],
            "description": "The country's export-control country groups, comma separated, e.g. `D:1,D:3,E:1`"
          },
          "derivation": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "ear_groups": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "ofac_programs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "eu_regimes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "adopted_by": {
                      "type": "string"
                    },
                    "measures": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "regional": {
                      "type": "boolean",
                      "description": "true when the regime is on occupied territory, not on the country"
                    }
                  },
                  "required": [
                    "id",
                    "adopted_by",
                    "measures",
                    "regional"
                  ]
                }
              },
              "eu_sector_measures": {
                "type": "integer",
                "description": "Distinct sectors the EU regimes on the country restrict"
              },
              "cpi": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "year": {
                    "type": "integer"
                  },
                  "score": {
                    "type": "number",
                    "description": "0-100; lower is more corrupt"
                  }
                },
                "required": [
                  "year",
                  "score"
                ]
              },
              "travel_advisory_level": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "1-4"
              },
              "fatf_status": {
                "type": "string",
                "enum": [
                  "blacklist",
                  "greylist",
                  "clear"
                ]
              }
            },
            "required": [
              "ear_groups",
              "ofac_programs",
              "eu_regimes",
              "eu_sector_measures",
              "cpi",
              "travel_advisory_level",
              "fatf_status"
            ],
            "description": "The facts behind the fields; null on a profile with none yet"
          },
          "derived_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "country_code",
          "country_name",
          "risk_level",
          "sanctioned",
          "embargo_type",
          "sanctions_programs",
          "risk_factors",
          "fatf_status",
          "fatf_list_date",
          "cpi_tier",
          "ear_group",
          "derivation",
          "derived_at",
          "updated_at"
        ]
      },
      "CustomsDocument": {
        "type": "object",
        "properties": {
          "document_type": {
            "type": "string",
            "enum": [
              "commercial_invoice",
              "packing_list",
              "combined"
            ]
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "invoice_number": {
            "type": "string",
            "description": "Yours, or a generated one"
          },
          "invoice_date": {
            "type": "string",
            "description": "Yours as sent, or today (YYYY-MM-DD)"
          },
          "po_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "incoterm": {
            "type": "string"
          },
          "shipper": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "address_line1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "address_line2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "postal_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2"
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tax_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "address_line1",
              "address_line2",
              "city",
              "state",
              "postal_code",
              "country",
              "phone",
              "email",
              "tax_id"
            ]
          },
          "consignee": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "address_line1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "address_line2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "postal_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2"
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tax_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "address_line1",
              "address_line2",
              "city",
              "state",
              "postal_code",
              "country",
              "phone",
              "email",
              "tax_id"
            ]
          },
          "transport": {
            "type": "object",
            "properties": {
              "mode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vessel_flight": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "port_of_loading": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "port_of_discharge": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "mode",
              "vessel_flight",
              "port_of_loading",
              "port_of_discharge"
            ]
          },
          "line_items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "item_number": {
                  "type": "integer",
                  "description": "Position in the document, from 1"
                },
                "description": {
                  "type": "string"
                },
                "hs_code": {
                  "type": "string",
                  "description": "Absent when you sent none"
                },
                "quantity": {
                  "type": "integer"
                },
                "unit": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The unit the quantity counts, as sent"
                },
                "unit_value": {
                  "type": "number"
                },
                "total_value": {
                  "type": "number",
                  "description": "quantity times unit_value"
                },
                "weight_kg": {
                  "type": "number",
                  "description": "Net weight of one unit; absent when you sent none"
                },
                "net_weight_kg": {
                  "type": "number",
                  "description": "weight_kg times quantity; absent when you sent no weight"
                },
                "country_of_origin": {
                  "type": "string",
                  "description": "ISO 3166-1 alpha-2; the shipper's country when you sent none"
                }
              },
              "required": [
                "item_number",
                "description",
                "quantity",
                "unit",
                "unit_value",
                "total_value",
                "country_of_origin"
              ]
            },
            "description": "commercial_invoice and combined only"
          },
          "summary": {
            "type": "object",
            "properties": {
              "total_items": {
                "type": "integer"
              },
              "total_quantity": {
                "type": "integer"
              },
              "subtotal": {
                "type": "number"
              },
              "freight_cost": {
                "type": "number"
              },
              "insurance_cost": {
                "type": "number"
              },
              "total_invoice_value": {
                "type": "number",
                "description": "subtotal plus freight plus insurance"
              }
            },
            "required": [
              "total_items",
              "total_quantity",
              "subtotal",
              "freight_cost",
              "insurance_cost",
              "total_invoice_value"
            ],
            "description": "commercial_invoice and combined only"
          },
          "declarations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "commercial_invoice and combined only: the declaration lines of the invoice"
          },
          "packing_details": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "item_number": {
                  "type": "integer"
                },
                "description": {
                  "type": "string"
                },
                "hs_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": "integer"
                },
                "unit": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "weight_kg": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Net weight of one unit"
                },
                "net_weight_kg": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "weight_kg times quantity"
                },
                "package_count": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "As you stated it; null when not stated"
                },
                "package_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "marks": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "item_number",
                "description",
                "hs_code",
                "quantity",
                "unit",
                "weight_kg",
                "net_weight_kg",
                "package_count",
                "package_type",
                "marks"
              ]
            },
            "description": "packing_list and combined only: one row per line, with the packages you stated"
          },
          "packing_summary": {
            "type": "object",
            "properties": {
              "total_packages": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The packages stated, summed; null unless every line states its count"
              },
              "lines_without_packages": {
                "type": "integer"
              },
              "total_quantity": {
                "type": "integer"
              },
              "total_net_weight_kg": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Net weight of the lines that state one; null when none does"
              },
              "lines_without_weight": {
                "type": "integer"
              },
              "total_weight_kg": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The same net weight, to the hundredth (kept for earlier callers)"
              }
            },
            "required": [
              "total_packages",
              "lines_without_packages",
              "total_quantity",
              "total_net_weight_kg",
              "lines_without_weight",
              "total_weight_kg"
            ],
            "description": "packing_list and combined only"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "document_type",
          "generated_at",
          "invoice_number",
          "invoice_date",
          "po_number",
          "currency",
          "incoterm",
          "shipper",
          "consignee",
          "transport",
          "notes"
        ]
      },
      "CustomsDocumentDraft": {
        "type": "object",
        "properties": {
          "purchase_order": {
            "type": "object",
            "properties": {
              "external_id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "order_date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "currency": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "external_id",
              "status",
              "order_date",
              "currency"
            ]
          },
          "shipper": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "city",
              "country"
            ]
          },
          "consignee": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "Your organization"
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "location": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The receiving location"
              }
            },
            "required": [
              "name",
              "city",
              "country",
              "location"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "po_number": {
            "type": "string"
          },
          "line_items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "description": {
                  "type": "string"
                },
                "item_code": {
                  "type": "string",
                  "description": "The item's id in your system"
                },
                "hs_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country_of_origin": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The item's country of origin, else the supplier's country (origin_basis says which)"
                },
                "origin_basis": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "item",
                    "supplier",
                    null
                  ]
                },
                "quantity": {
                  "type": "number",
                  "description": "What is still to receive on the line, or the ordered quantity when nothing was received"
                },
                "quantity_basis": {
                  "type": "string",
                  "enum": [
                    "remaining",
                    "ordered"
                  ]
                },
                "unit": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unit_value": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "The line's unit price, in the order's currency"
                },
                "weight_kg": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "The item's net weight per unit, kg"
                }
              },
              "required": [
                "description",
                "item_code",
                "hs_code",
                "country_of_origin",
                "origin_basis",
                "quantity",
                "quantity_basis",
                "unit",
                "unit_value",
                "weight_kg"
              ]
            }
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What to add or check before building the document (packages are always among them)"
          }
        },
        "required": [
          "purchase_order",
          "shipper",
          "consignee",
          "currency",
          "po_number",
          "line_items",
          "missing"
        ]
      },
      "DemandSource": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "daily_demand",
              "order_lines"
            ],
            "description": "Which demand history the answer was computed from. daily_demand: the daily history we keep (point of sale where a store has a feed, sales orders elsewhere). order_lines: your sales order lines, added up for this request while that history is not complete"
          },
          "history_complete": {
            "type": "boolean",
            "description": "Whether the stored daily demand history is complete for the organization"
          },
          "history_as_of": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Every change committed before this time is in the stored history; null while it is not complete"
          },
          "fallback_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "history_not_built",
              "history_rebuilding",
              "history_lagging",
              null
            ],
            "description": "Why the stored history did not answer; null when it did"
          }
        },
        "required": [
          "source",
          "history_complete",
          "history_as_of",
          "fallback_reason"
        ]
      },
      "DeniedPartyScreening": {
        "type": "object",
        "properties": {
          "screening_id": {
            "type": "string",
            "format": "uuid"
          },
          "searched_party": {
            "type": "object",
            "properties": {
              "first_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "company_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country_code": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "first_name",
              "last_name",
              "company_name",
              "country_code"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "CLEAR",
              "REVIEW",
              "BLOCK"
            ],
            "description": "The screening's outcome. A second opinion never changes it"
          },
          "match_count": {
            "type": "integer",
            "description": "The number of matches listed"
          },
          "best_score": {
            "type": "number",
            "description": "The highest score among the candidates, 0 to 1; it can be below the 0.5 a listed match needs, so it can be above 0 with no match listed"
          },
          "matches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "denied_party": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "alt_names": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "entity_type": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Entity, Individual, Vessel or Aircraft, when the list says"
                    },
                    "country": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "ISO 3166-1 alpha-2"
                    },
                    "locality": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "address_line1": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_list": {
                      "type": "string",
                      "description": "The list the party is on"
                    },
                    "source_list_code": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "programs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The sanctions programmes the listing names"
                    },
                    "federal_register_notice": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "start_date": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date"
                    },
                    "end_date": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date"
                    },
                    "remarks": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "alt_names",
                    "entity_type",
                    "country",
                    "locality",
                    "address_line1",
                    "source_list",
                    "source_list_code",
                    "programs",
                    "federal_register_notice",
                    "start_date",
                    "end_date",
                    "remarks",
                    "source_url"
                  ]
                },
                "scores": {
                  "type": "object",
                  "properties": {
                    "name_score": {
                      "type": "number",
                      "description": "How alike the names are, 0 to 1"
                    },
                    "name_match": {
                      "type": "string",
                      "enum": [
                        "EXACT_MATCH",
                        "PARTIAL_MATCH",
                        "NO_MATCH"
                      ]
                    },
                    "country_match": {
                      "type": "string",
                      "enum": [
                        "EXACT_MATCH",
                        "NO_MATCH"
                      ]
                    },
                    "overall_score": {
                      "type": "number",
                      "description": "The match's score, 0 to 1; a listed match has at least 0.5"
                    }
                  },
                  "required": [
                    "name_score",
                    "name_match",
                    "country_match",
                    "overall_score"
                  ]
                }
              },
              "required": [
                "denied_party",
                "scores"
              ]
            }
          },
          "ai_analysis": {
            "type": [
              "string",
              "null"
            ],
            "description": "A model's second opinion on a REVIEW outcome, as text; null when none was made"
          },
          "ai_opinion": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "matches": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "same_entity": {
                      "type": "boolean",
                      "description": "Whether the screened party is likely this listed party"
                    },
                    "confidence": {
                      "type": "string",
                      "enum": [
                        "HIGH",
                        "MEDIUM",
                        "LOW"
                      ]
                    },
                    "reasoning": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "same_entity",
                    "confidence",
                    "reasoning"
                  ]
                },
                "description": "One per match looked at (the first five), in the order of matches"
              },
              "recommendation": {
                "type": "string",
                "enum": [
                  "false_positive",
                  "escalate",
                  "proceed_with_caution"
                ]
              }
            },
            "required": [
              "matches",
              "recommendation"
            ],
            "description": "The same second opinion as fields; advisory only"
          },
          "duration_ms": {
            "type": "integer"
          },
          "disclaimer": {
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "description": "Quote this when asking about the request; also the X-Request-ID header"
          }
        },
        "required": [
          "screening_id",
          "searched_party",
          "action",
          "match_count",
          "best_score",
          "matches",
          "ai_analysis",
          "ai_opinion",
          "duration_ms",
          "disclaimer",
          "request_id"
        ]
      },
      "DisruptionEventExposure": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "signal_class": {
            "type": "string",
            "enum": [
              "supply_risk",
              "demand_driver"
            ],
            "description": "supply_risk: something that can interrupt supply. demand_driver: something that moves demand (a holiday, a shopping peak, an event near stores)"
          },
          "event_type": {
            "type": "string",
            "description": "The kind of event: earthquake, flood_warning, tariff_action, holiday_peak, ..."
          },
          "severity": {
            "type": "integer",
            "description": "1 (minor) to 5 (severe)"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_codes": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "ISO 3166-1 alpha-2 country code"
            }
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "exposure": {
            "type": "object",
            "properties": {
              "score": {
                "type": "number",
                "description": "0-100: how exposed your network is to the event. 0 means no exposure was found"
              },
              "affected_supplier_count": {
                "type": "integer",
                "description": "Your suppliers in the event's countries"
              },
              "affected_suppliers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "external_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "country_code": {
                      "type": "string",
                      "description": "ISO 3166-1 alpha-2 country code"
                    }
                  },
                  "required": [
                    "external_id",
                    "name",
                    "country_code"
                  ]
                },
                "description": "The first 10 of them"
              },
              "value_at_risk": {
                "type": "number",
                "description": "Value still open on purchase orders with those suppliers, each order in its own currency (not converted)"
              },
              "open_purchase_orders": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "external_id": {
                      "type": "string"
                    },
                    "supplier_external_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string"
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expected_delivery_date": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date"
                    },
                    "value_at_risk": {
                      "type": "number",
                      "description": "Value still open on the order"
                    }
                  },
                  "required": [
                    "external_id",
                    "supplier_external_id",
                    "status",
                    "currency",
                    "expected_delivery_date",
                    "value_at_risk"
                  ]
                },
                "description": "The first 20 open orders with those suppliers"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "external_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "quantity_on_hand": {
                      "type": "number"
                    },
                    "days_of_cover": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Days the stock on hand lasts at the recent rate of demand; null when there is no recent demand"
                    },
                    "single_sourced_in_affected_region": {
                      "type": "boolean",
                      "description": "true when every supplier the item has been bought from is in the event's countries"
                    }
                  },
                  "required": [
                    "external_id",
                    "description",
                    "quantity_on_hand",
                    "days_of_cover",
                    "single_sourced_in_affected_region"
                  ]
                },
                "description": "The first 20 items on those orders"
              }
            },
            "required": [
              "score",
              "affected_supplier_count",
              "affected_suppliers",
              "value_at_risk",
              "open_purchase_orders",
              "items"
            ]
          }
        },
        "required": [
          "id",
          "signal_class",
          "event_type",
          "severity",
          "title",
          "summary",
          "country_codes",
          "starts_at",
          "ends_at",
          "exposure"
        ]
      },
      "DisruptionProductExposure": {
        "type": "object",
        "properties": {
          "item_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "on_hand": {
            "type": "number"
          },
          "demand_qty": {
            "type": "number",
            "description": "Units sold over the window"
          },
          "single_sourced": {
            "type": "boolean",
            "description": "true when an event reaches every supplier the item is bought from"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "title": {
                  "type": "string"
                },
                "event_type": {
                  "type": "string"
                },
                "severity": {
                  "type": "integer",
                  "description": "1 (minor) to 5 (severe)"
                },
                "signal_class": {
                  "type": "string",
                  "enum": [
                    "supply_risk",
                    "demand_driver"
                  ],
                  "description": "supply_risk: something that can interrupt supply. demand_driver: something that moves demand (a holiday, a shopping peak, an event near stores)"
                }
              },
              "required": [
                "id",
                "title",
                "event_type",
                "severity",
                "signal_class"
              ]
            },
            "description": "Every active event that reaches the item, most severe first"
          },
          "max_severity": {
            "type": "integer",
            "description": "1 (minor) to 5 (severe)"
          },
          "event_count": {
            "type": "integer"
          }
        },
        "required": [
          "item_id",
          "external_id",
          "description",
          "on_hand",
          "demand_qty",
          "single_sourced",
          "events",
          "max_severity",
          "event_count"
        ]
      },
      "DisruptionRankedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "signal_class": {
            "type": "string",
            "enum": [
              "supply_risk",
              "demand_driver"
            ],
            "description": "supply_risk: something that can interrupt supply. demand_driver: something that moves demand (a holiday, a shopping peak, an event near stores)"
          },
          "event_type": {
            "type": "string",
            "description": "The kind of event: earthquake, flood_warning, tariff_action, holiday_peak, ..."
          },
          "severity": {
            "type": "integer",
            "description": "1 (minor) to 5 (severe)"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_codes": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "ISO 3166-1 alpha-2 country code"
            }
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "exposure": {
            "type": "object",
            "properties": {
              "score": {
                "type": "number",
                "description": "0-100: how exposed your network is to the event. 0 means no exposure was found"
              },
              "affected_supplier_count": {
                "type": "integer"
              },
              "affected_suppliers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "external_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "country_code": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "ISO 3166-1 alpha-2 country code"
                    }
                  },
                  "required": [
                    "external_id",
                    "name",
                    "country_code"
                  ]
                }
              },
              "value_at_risk": {
                "type": "number",
                "description": "Value still open on purchase orders with those suppliers, each order in its own currency (not converted)"
              },
              "open_po_count": {
                "type": "integer"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "external_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "quantity_on_hand": {
                      "type": "number"
                    },
                    "demand_qty": {
                      "type": "number",
                      "description": "Units sold over the window"
                    },
                    "days_of_cover": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Days the stock on hand lasts at the window's rate of demand; null when the window has no demand"
                    },
                    "single_sourced": {
                      "type": "boolean",
                      "description": "true when the event reaches every supplier the item is bought from"
                    }
                  },
                  "required": [
                    "external_id",
                    "description",
                    "quantity_on_hand",
                    "demand_qty",
                    "days_of_cover",
                    "single_sourced"
                  ]
                }
              }
            },
            "required": [
              "score",
              "affected_supplier_count",
              "affected_suppliers",
              "value_at_risk",
              "open_po_count",
              "items"
            ]
          }
        },
        "required": [
          "id",
          "signal_class",
          "event_type",
          "severity",
          "title",
          "summary",
          "country_codes",
          "starts_at",
          "ends_at",
          "exposure"
        ]
      },
      "DutyOrder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "case_number": {
            "type": "string"
          },
          "case_type": {
            "type": "string",
            "enum": [
              "AD",
              "CVD"
            ],
            "description": "AD: anti-dumping. CVD: countervailing"
          },
          "country_code": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "country_name": {
            "type": "string"
          },
          "product_description": {
            "type": "string"
          },
          "hs_code_prefixes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The tariff numbers the order names, dotted as published"
          },
          "rate_percent": {
            "type": [
              "number",
              "null"
            ]
          },
          "rate_range_min": {
            "type": [
              "number",
              "null"
            ]
          },
          "rate_range_max": {
            "type": [
              "number",
              "null"
            ]
          },
          "all_others_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "The rate for exporters without a rate of their own"
          },
          "status": {
            "type": "string",
            "description": "active: in force. revoked: ended. suspended: a suspension agreement is in place, no duty is collected. unconfirmed: no continuation on record. An order awaiting review may carry another value"
          },
          "active": {
            "type": "boolean"
          },
          "effective_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "revoked_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "continued_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "federal_register_citation": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "official_register",
              "reviewed"
            ],
            "description": "official_register: the order is in the official register of orders. reviewed: entered from the order's notice and not yet matched to the register"
          },
          "hs_source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "official_register",
              "official_notice",
              "reviewed",
              null
            ],
            "description": "Where the tariff numbers come from. official_notice: the scope of the order's published notice. reviewed: entered by hand from it"
          },
          "rate_source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "official_register",
              "official_notice",
              "reviewed",
              null
            ],
            "description": "Where the rates come from, as hs_source"
          },
          "rate_basis": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the rate is a percentage of, when the source says"
          },
          "source_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the order was last seen in its source"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "hs_match": {
            "type": "string",
            "enum": [
              "exact",
              "possible"
            ],
            "description": "Only with the `hs_code` filter. exact: an order number is a prefix of the code asked for. possible: the code asked for is less specific than an order number, so it may be covered"
          }
        },
        "required": [
          "id",
          "case_number",
          "case_type",
          "country_code",
          "country_name",
          "product_description",
          "hs_code_prefixes",
          "rate_percent",
          "rate_range_min",
          "rate_range_max",
          "all_others_rate",
          "status",
          "active",
          "effective_date",
          "revoked_date",
          "continued_date",
          "federal_register_citation",
          "source_url",
          "origin",
          "hs_source",
          "rate_source",
          "rate_basis",
          "source_seen_at",
          "updated_at"
        ]
      },
      "EgOtherCharges": {
        "type": "object",
        "properties": {
          "duty_per_unit": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "per_unit",
                    "minimum_per_unit"
                  ]
                },
                "amount_egp": {
                  "type": "number"
                },
                "per": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The unit the amount is charged on"
                },
                "rate": {
                  "type": "string"
                },
                "text": {
                  "type": "string",
                  "description": "The authority's own wording"
                }
              },
              "required": [
                "kind",
                "amount_egp",
                "per",
                "rate",
                "text"
              ]
            },
            "description": "The parts of the import duty charged per unit, which a percentage does not carry. Landed cost computes them when the request sends measures"
          },
          "other_taxes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tax": {
                  "type": "string",
                  "enum": [
                    "vat",
                    "table_tax",
                    "other"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "name_local": {
                  "type": "string",
                  "description": "The tax's name in Arabic, as published"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "percent_of_value_plus_duty",
                    "percent",
                    "per_unit",
                    "minimum_per_unit",
                    "not_readable"
                  ],
                  "description": "percent_of_value_plus_duty: a percentage of the customs value plus customs duty, as the line states. percent: a percentage with no base stated. per_unit and minimum_per_unit: Egyptian pounds per unit. not_readable: wording that is not read as a rate"
                },
                "rate_percent": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "amount_egp": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "per": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The unit a per-unit amount is charged on"
                },
                "rate": {
                  "type": "string",
                  "description": "The rate as an answer prints it"
                },
                "text": {
                  "type": "string",
                  "description": "The authority's own wording"
                }
              },
              "required": [
                "tax",
                "name",
                "name_local",
                "kind",
                "rate_percent",
                "amount_egp",
                "per",
                "rate",
                "text"
              ]
            }
          },
          "fees": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "instruction": {
                  "type": "string",
                  "description": "The code of the tariff instruction that sets the fee"
                },
                "name": {
                  "type": "string"
                },
                "rate_percent": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "null when the instruction's text does not settle the amount"
                },
                "base": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "value_plus_all_taxes",
                    null
                  ],
                  "description": "The customs value with customs duty, VAT and the other taxes added"
                },
                "text": {
                  "type": "string"
                }
              },
              "required": [
                "instruction",
                "name",
                "rate_percent",
                "base",
                "text"
              ]
            }
          },
          "trade_remedies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "instruction": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              },
              "required": [
                "instruction",
                "text"
              ]
            }
          }
        },
        "required": [
          "duty_per_unit",
          "other_taxes",
          "fees",
          "trade_remedies"
        ]
      },
      "EmissionFactorSet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "publisher": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "published_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "licence": {
            "type": "string"
          },
          "licence_url": {
            "type": "string"
          },
          "attribution": {
            "type": "string",
            "description": "The credit line the licence asks for"
          },
          "source_url": {
            "type": "string",
            "description": "The file the factors were read from"
          },
          "file_sha256": {
            "type": "string"
          },
          "method_notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency_year": {
            "type": [
              "integer",
              "null"
            ],
            "description": "For spend factors: the US dollar year"
          }
        },
        "required": [
          "id",
          "key",
          "publisher",
          "title",
          "version",
          "published_on",
          "licence",
          "licence_url",
          "attribution",
          "source_url",
          "file_sha256",
          "method_notes",
          "currency_year"
        ]
      },
      "ErpConnection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "system_type": {
            "type": "string",
            "description": "The kind of source system, a lowercase identifier"
          },
          "ingest_mode": {
            "type": "string",
            "description": "push: records are sent to us; pull: we read them on a schedule"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disconnected"
            ]
          },
          "pull_enabled": {
            "type": "boolean",
            "description": "Whether the scheduled pull is set up; only such a connection can be synced"
          },
          "schedule_minutes": {
            "type": "integer",
            "description": "Minutes between scheduled pulls"
          },
          "last_sync_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The last pull"
          },
          "last_sync_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "How the last pull ended: success, partial, failed or error"
          },
          "last_sync_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_ingest_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The last time records arrived, pushed or pulled"
          },
          "last_ingest_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "success, partial or failed"
          },
          "access_mode": {
            "type": "string",
            "enum": [
              "read_only",
              "read_write"
            ],
            "description": "read_only (every connection's start): nothing is written to the source; read_write: an organization admin allowed writes"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "writeback_enabled": {
            "type": "boolean",
            "description": "access_mode is read_write"
          },
          "entities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entity": {
                  "type": "string",
                  "description": "suppliers, items, purchase_orders, ..."
                },
                "synced_through": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time",
                  "description": "Changes up to this time are synced; null on a first sync or for an entity that is read in full every time"
                },
                "resume_pending": {
                  "type": "boolean",
                  "description": "A pull was left part-way and the next sync resumes it"
                },
                "last_run": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/IngestEntityCounts"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Counts from the connection's latest sync run; null when that run did not touch the entity"
                }
              },
              "required": [
                "entity",
                "synced_through",
                "resume_pending",
                "last_run"
              ]
            },
            "description": "The entities the connection pulls, in sync order; empty for a push-only connection"
          },
          "latest_sync_run": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "running",
                  "success",
                  "partial",
                  "failed"
                ]
              },
              "started_at": {
                "type": "string",
                "format": "date-time"
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "error_count": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "status",
              "started_at",
              "finished_at",
              "error_count"
            ],
            "description": "The newest run that brought records in, pushed or pulled; null before the first"
          },
          "active_run": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "run_id": {
                "type": "string",
                "format": "uuid",
                "description": "The id of the running sync. It is not the id of a row of GET /v1/sync_runs: those rows list the records a sync brought in"
              },
              "status": {
                "type": "string",
                "enum": [
                  "running",
                  "continued"
                ]
              },
              "locked_until": {
                "type": "string",
                "format": "date-time",
                "description": "When the lock lapses if the run stops moving"
              }
            },
            "required": [
              "run_id",
              "status",
              "locked_until"
            ],
            "description": "The sync running now; while it is set, starting another answers 409"
          }
        },
        "required": [
          "id",
          "name",
          "system_type",
          "ingest_mode",
          "status",
          "pull_enabled",
          "schedule_minutes",
          "last_sync_at",
          "last_sync_status",
          "last_sync_message",
          "last_ingest_at",
          "last_ingest_status",
          "access_mode",
          "created_at",
          "updated_at",
          "writeback_enabled",
          "entities",
          "latest_sync_run",
          "active_run"
        ]
      },
      "EsgPeriod": {
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "format": "date"
          },
          "end": {
            "type": "string",
            "format": "date"
          },
          "label": {
            "type": "string",
            "description": "For example Calendar year 2025"
          },
          "kind": {
            "type": "string",
            "enum": [
              "calendar_year",
              "fiscal_year",
              "custom",
              "trailing_12_months"
            ]
          }
        },
        "required": [
          "start",
          "end",
          "label",
          "kind"
        ]
      },
      "ExecutionDecision": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "blocked",
              "manual",
              "auto_approve",
              "auto_execute"
            ],
            "description": "manual: the order waits for a person; auto_approve / auto_execute: the rule approved (and ran) it"
          },
          "level": {
            "type": "number",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "description": "0 recommend only, 1 a person approves, 2 approved inside its limits, 3 approved and executed inside its limits"
          },
          "policy_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The rule that decided; null when the default (a person approves) applied"
          },
          "version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rule": {
                  "type": "string",
                  "enum": [
                    "max_amount",
                    "max_quantity",
                    "daily_budget",
                    "daily_max_orders",
                    "allowed_locations",
                    "allowed_suppliers",
                    "min_priority",
                    "cooldown_hours",
                    "level",
                    "enabled",
                    "edited_quantity",
                    "compliance"
                  ],
                  "description": "The rule that was checked"
                },
                "ok": {
                  "type": "boolean"
                },
                "detail": {
                  "type": "string",
                  "description": "What was compared, in words"
                }
              },
              "required": [
                "rule",
                "ok",
                "detail"
              ]
            }
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Why the order waits for a person, in order; empty when the rule approved it"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "outcome",
          "level",
          "policy_id",
          "version",
          "checks",
          "reasons",
          "evaluated_at"
        ]
      },
      "ExecutionOrder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "recommendation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The recommendation it was proposed from; null once that recommendation is gone"
          },
          "connection_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The ERP connection it is written to; null when it is handed over by hand"
          },
          "kind": {
            "type": "string",
            "enum": [
              "stock_transfer",
              "purchase_order",
              "expedite",
              "markdown"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "proposed",
              "approved",
              "rejected",
              "canceled",
              "executing",
              "executed",
              "partially_applied",
              "failed"
            ],
            "description": "partially_applied: written, but the ERP stored something other than what was sent"
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "live",
              "dry_run",
              "manual",
              null
            ],
            "description": "How it was executed: written to the ERP, rehearsed without writing, or handed over by hand; null until it runs"
          },
          "payload": {
            "type": "object",
            "properties": {
              "summary": {
                "type": "string",
                "description": "The order in one line"
              },
              "item_external_id": {
                "type": "string"
              },
              "quantity": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "stock_transfer, purchase_order, expedite"
              },
              "from_location_external_id": {
                "type": "string",
                "description": "stock_transfer"
              },
              "to_location_external_id": {
                "type": "string",
                "description": "stock_transfer"
              },
              "supplier_external_id": {
                "type": "string",
                "description": "purchase_order"
              },
              "location_external_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "purchase_order, expedite, markdown: the receiving or selling location"
              },
              "unit_cost": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "purchase_order"
              },
              "currency": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "purchase_order"
              },
              "discount_pct": {
                "type": "number",
                "description": "markdown"
              },
              "external_ref": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "On older orders only: the document number, now the order's own external_ref"
              }
            },
            "required": [
              "summary",
              "item_external_id"
            ],
            "description": "The order as it executes; which fields it carries depends on kind"
          },
          "expected_impact": {
            "type": "object",
            "additionalProperties": true,
            "description": "The recommendation's expected impact; the fields depend on its kind"
          },
          "recommendation_snapshot": {
            "type": "object",
            "properties": {
              "recommendation_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "kind": {
                "type": "string",
                "description": "The recommendation's kind"
              },
              "quantity": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The recommended quantity (the order's own quantity is in payload)"
              },
              "priority": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "rationale": {
                "type": "object",
                "additionalProperties": true,
                "description": "The recommendation's rationale as it was"
              },
              "expected_impact": {
                "type": "object",
                "additionalProperties": true,
                "description": "The recommendation's expected impact as it was"
              },
              "data_as_of": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "recommended_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "item_external_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "from_location_external_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "to_location_external_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "supplier_external_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unit_cost": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "currency": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "captured_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "description": "The order's own copy of what was recommended and why, taken when it was proposed. Empty on orders from before snapshots were kept"
          },
          "idempotency_key": {
            "type": "string"
          },
          "maker": {
            "type": "string",
            "format": "uuid",
            "description": "The person who proposed it, or who last set its quantity"
          },
          "maker_api_key_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The API key the proposer used, when it was proposed over the API"
          },
          "checker": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The person who approved or rejected it"
          },
          "checker_api_key_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "auto_approved": {
            "type": "boolean",
            "description": "true when an execution rule approved it instead of a person"
          },
          "policy_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "policy_decision": {
            "type": "object",
            "properties": {
              "outcome": {
                "type": "string",
                "enum": [
                  "blocked",
                  "manual",
                  "auto_approve",
                  "auto_execute"
                ],
                "description": "manual: a person approves; auto_approve / auto_execute: the rule approved (and ran) it"
              },
              "level": {
                "type": "number",
                "enum": [
                  0,
                  1,
                  2,
                  3
                ],
                "description": "The autonomy level of the rule: 0 recommend only, 1 a person approves, 2 approved inside its limits, 3 approved and executed inside its limits"
              },
              "policy_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid",
                "description": "The rule that decided; null when the default applied"
              },
              "version": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "checks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "rule": {
                      "type": "string",
                      "enum": [
                        "max_amount",
                        "max_quantity",
                        "daily_budget",
                        "daily_max_orders",
                        "allowed_locations",
                        "allowed_suppliers",
                        "min_priority",
                        "cooldown_hours",
                        "level",
                        "enabled",
                        "edited_quantity",
                        "compliance"
                      ],
                      "description": "The rule that was checked"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "detail": {
                      "type": "string",
                      "description": "What was compared, in words"
                    }
                  },
                  "required": [
                    "rule",
                    "ok",
                    "detail"
                  ]
                }
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Why the order waits for a person, in order"
              },
              "evaluated_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "description": "The execution rule's decision when the order was proposed (and after a quantity change). Empty on orders from before execution rules"
          },
          "amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "The value the order moves, when it has one"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_ref": {
            "type": [
              "string",
              "null"
            ],
            "description": "The document number in the ERP; MANUAL-... or DRYRUN-... when nothing was written"
          },
          "verification": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WritebackVerification"
              },
              {
                "type": "null"
              }
            ],
            "description": "The read-back of a live write; null for a dry run or a manual hand-over"
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the last execution failed"
          },
          "approved_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was approved or rejected"
          },
          "executed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "recommendation_id",
          "connection_id",
          "kind",
          "status",
          "mode",
          "payload",
          "expected_impact",
          "recommendation_snapshot",
          "idempotency_key",
          "maker",
          "maker_api_key_id",
          "checker",
          "checker_api_key_id",
          "auto_approved",
          "policy_id",
          "policy_decision",
          "amount",
          "currency",
          "external_ref",
          "verification",
          "error",
          "approved_at",
          "executed_at",
          "created_at",
          "updated_at"
        ]
      },
      "ExecutionOrderResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "proposed",
              "approved",
              "rejected",
              "canceled",
              "executing",
              "executed",
              "partially_applied",
              "failed"
            ],
            "description": "The order's status after the action. A repeated propose answers the existing order's status, whatever it is now. partially_applied: written, but the ERP stored something other than what was sent"
          },
          "quantity": {
            "type": "number",
            "description": "edit_quantity: the new quantity"
          },
          "previous_quantity": {
            "type": [
              "number",
              "null"
            ],
            "description": "edit_quantity: the quantity it replaced"
          },
          "amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "edit_quantity: the order's value at the new quantity, when it has one"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "edit_quantity"
          },
          "maker": {
            "type": "string",
            "format": "uuid",
            "description": "edit_quantity: who set the quantity. That person is now the order's proposer, so someone else approves"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "dry_run",
              "manual"
            ],
            "description": "execute: how it ran. live: written to the ERP; dry_run: rehearsed, nothing written; manual: handed over by hand"
          },
          "external_ref": {
            "type": [
              "string",
              "null"
            ],
            "description": "execute: the document number in the ERP; MANUAL-... or DRYRUN-... when nothing was written; null when it failed"
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "execute: why it failed"
          },
          "verification": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WritebackVerificationSummary"
              },
              {
                "type": "null"
              }
            ],
            "description": "execute: the read-back of a live write, null otherwise. verify: the new read-back"
          }
        },
        "required": [
          "id",
          "status"
        ],
        "description": "propose, approve, reject, cancel: id and status. edit_quantity: also quantity, previous_quantity, amount, currency and maker. execute (and a propose a level-3 rule executed at once): also mode, external_ref, error and verification. verify: also verification"
      },
      "ExecutionPolicy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "order_kind": {
            "type": "string",
            "enum": [
              "stock_transfer",
              "purchase_order",
              "expedite",
              "markdown"
            ]
          },
          "version": {
            "type": "integer"
          },
          "level": {
            "type": "number",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "description": "0 recommend only, 1 a person approves, 2 approved inside its limits, 3 approved and executed inside its limits"
          },
          "guardrails": {
            "type": "object",
            "properties": {
              "max_amount": {
                "type": "number",
                "description": "Largest order value the rule may approve"
              },
              "max_quantity": {
                "type": "number"
              },
              "daily_budget": {
                "type": "number",
                "description": "Sum of order values the rule may approve per UTC day"
              },
              "daily_max_orders": {
                "type": "integer",
                "description": "Orders the rule may approve per UTC day"
              },
              "allowed_locations": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Location numbers the order may touch; absent means any"
              },
              "allowed_suppliers": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Supplier numbers a purchase order may go to; absent means any"
              },
              "min_priority": {
                "type": "number",
                "description": "Lowest recommendation priority (0 to 100) the rule acts on"
              },
              "cooldown_hours": {
                "type": "number",
                "description": "No second automatic order for the same item and location within this many hours"
              }
            },
            "description": "The limits inside which the rule acts on its own; only the limits that are set are present"
          },
          "enabled": {
            "type": "boolean",
            "description": "false while the rule is paused: every order then waits for a person"
          },
          "paused_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "paused_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "order_kind",
          "version",
          "level",
          "guardrails",
          "enabled",
          "paused_reason",
          "paused_at",
          "created_by",
          "created_at"
        ]
      },
      "ForecastAccuracyRow": {
        "type": "object",
        "properties": {
          "level": {
            "type": "string",
            "enum": [
              "item_location",
              "item",
              "category",
              "location",
              "location_type",
              "org"
            ]
          },
          "node": {
            "type": "string",
            "description": "The row's key at its level"
          },
          "label": {
            "type": "string"
          },
          "item_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "location_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "period_start": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The origin week (weekly rows); null on a summary row"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "insufficient_history",
              "no_actuals"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the row carries no number; null when status is ok"
          },
          "sample": {
            "type": "object",
            "properties": {
              "leaves": {
                "type": "integer",
                "description": "Item-location series under the row"
              },
              "origins": {
                "type": "integer"
              },
              "points": {
                "type": "integer",
                "description": "Forecast points scored"
              },
              "actual_total": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "history_weeks": {
                "type": "integer"
              }
            },
            "required": [
              "leaves",
              "origins",
              "points",
              "actual_total",
              "history_weeks"
            ]
          },
          "ours": {
            "type": "object",
            "properties": {
              "mae": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean absolute error, units per week"
              },
              "rmse": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "bias": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean error; above 0 is over-forecast"
              },
              "bias_pct": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "wape_pct": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Weighted absolute percentage error"
              },
              "mase": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean absolute scaled error"
              },
              "rmsse": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Root mean squared scaled error"
              },
              "mae_by_horizon": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "number"
                },
                "description": "One value per week of the horizon"
              },
              "bias_by_horizon": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "number"
                }
              },
              "methods": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer"
                },
                "description": "Scored weeks by kind of forecast: smoothed_weekday, intermittent or none"
              }
            },
            "required": [
              "mae",
              "rmse",
              "bias",
              "bias_pct",
              "wape_pct",
              "mase",
              "rmsse",
              "mae_by_horizon",
              "bias_by_horizon",
              "methods"
            ],
            "description": "Our forecast"
          },
          "naive": {
            "type": "object",
            "properties": {
              "mae": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean absolute error, units per week"
              },
              "rmse": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "bias": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean error; above 0 is over-forecast"
              },
              "bias_pct": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "wape_pct": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Weighted absolute percentage error"
              },
              "mase": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean absolute scaled error"
              },
              "rmsse": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Root mean squared scaled error"
              },
              "mae_by_horizon": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "number"
                },
                "description": "One value per week of the horizon"
              },
              "bias_by_horizon": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "number"
                }
              }
            },
            "required": [
              "mae",
              "rmse",
              "bias",
              "bias_pct",
              "wape_pct",
              "mase",
              "rmsse",
              "mae_by_horizon",
              "bias_by_horizon"
            ],
            "description": "The last week repeated"
          },
          "seasonal_naive": {
            "type": "object",
            "properties": {
              "mae": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean absolute error, units per week"
              },
              "rmse": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "bias": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean error; above 0 is over-forecast"
              },
              "bias_pct": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "wape_pct": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Weighted absolute percentage error"
              },
              "mase": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Mean absolute scaled error"
              },
              "rmsse": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Root mean squared scaled error"
              },
              "mae_by_horizon": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "number"
                },
                "description": "One value per week of the horizon"
              },
              "bias_by_horizon": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "number"
                }
              },
              "seasonal_share": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Share of points that had a year-earlier week to use (0-1)"
              }
            },
            "required": [
              "mae",
              "rmse",
              "bias",
              "bias_pct",
              "wape_pct",
              "mase",
              "rmsse",
              "mae_by_horizon",
              "bias_by_horizon",
              "seasonal_share"
            ],
            "description": "The same week a year earlier"
          },
          "value_add": {
            "type": "object",
            "properties": {
              "rmsse_ratio": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Our scaled error over naive's; below 1 beats naive"
              },
              "wape_points": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Naive's percentage error minus ours, in points; above 0 means ours is better"
              },
              "beats_naive": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            },
            "required": [
              "rmsse_ratio",
              "wape_points",
              "beats_naive"
            ]
          }
        },
        "required": [
          "level",
          "node",
          "label",
          "item_id",
          "location_id",
          "period_start",
          "status",
          "reason",
          "sample",
          "ours",
          "naive",
          "seasonal_naive",
          "value_add"
        ]
      },
      "ForecastCheckRow": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "The row's position in the request (0-based)"
          },
          "ref": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "The row's `ref` as sent; null when none was sent or the row came from a stored forecast"
          },
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "location": {
            "type": "string",
            "description": "Location external id"
          },
          "period": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string",
                "format": "date"
              },
              "end": {
                "type": "string",
                "format": "date",
                "description": "The period's last day"
              },
              "days": {
                "type": "integer"
              }
            },
            "required": [
              "start",
              "end",
              "days"
            ]
          },
          "quantity": {
            "type": "number",
            "description": "Your forecast for the whole period"
          },
          "status": {
            "const": "ok"
          },
          "history": {
            "type": "object",
            "properties": {
              "window_days": {
                "type": "integer"
              },
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "demand_days": {
                "type": "integer",
                "description": "Days in the window with any demand"
              },
              "total_quantity": {
                "type": "number"
              },
              "mean_daily": {
                "type": "number"
              },
              "classification": {
                "type": "string",
                "enum": [
                  "steady",
                  "variable",
                  "intermittent",
                  "lumpy",
                  "no_demand"
                ],
                "description": "The demand pattern over the window"
              }
            },
            "required": [
              "window_days",
              "from",
              "to",
              "demand_days",
              "total_quantity",
              "mean_daily",
              "classification"
            ]
          },
          "baseline": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "quantity": {
                "type": "number",
                "description": "Our baseline for the whole period"
              },
              "daily_rate": {
                "type": "number"
              },
              "method": {
                "type": "string",
                "enum": [
                  "smoothed_weekday",
                  "intermittent"
                ],
                "description": "How the baseline was computed. smoothed_weekday: smoothed demand with a weekday pattern. intermittent: for demand that arrives on few days"
              },
              "classification": {
                "type": "string",
                "enum": [
                  "steady",
                  "variable",
                  "intermittent",
                  "lumpy",
                  "no_demand"
                ],
                "description": "The demand pattern over the window"
              },
              "in_sample_mae": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The baseline's mean absolute error per day on history; null when the method reports none"
              },
              "period_offset_days": {
                "type": "integer",
                "description": "Days from today to the period's first day (0: today)"
              }
            },
            "required": [
              "quantity",
              "daily_rate",
              "method",
              "classification",
              "in_sample_mae",
              "period_offset_days"
            ],
            "description": "Null when the history is too thin for a baseline; baseline_reason then says why"
          },
          "baseline_reason": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "no_demand_in_window",
                  "too_few_demand_days"
                ]
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          },
          "difference": {
            "type": "object",
            "properties": {
              "absolute": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Your quantity minus the baseline; null without a baseline"
              },
              "percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The difference in percent of the baseline; null without a baseline or when the baseline is 0"
              },
              "band": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "pct": {
                    "type": "number",
                    "description": "The band used, in percent: a difference at or under it agrees"
                  },
                  "tolerance_pct": {
                    "type": "number",
                    "description": "The tolerance of the request"
                  },
                  "noise_pct": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "The baseline's own uncertainty over the period, in percent of the baseline; null when the baseline is 0"
                  },
                  "noise_basis": {
                    "type": "string",
                    "enum": [
                      "in_sample_mae",
                      "daily_std_dev"
                    ],
                    "description": "What noise_daily is: the baseline's mean daily error on history, or the daily standard deviation of demand"
                  },
                  "noise_daily": {
                    "type": "number",
                    "description": "Units per day"
                  },
                  "capped": {
                    "type": "boolean",
                    "description": "True when the band was cut at options.max_band_pct"
                  },
                  "rule": {
                    "type": "string",
                    "description": "The agreement rule, in words"
                  }
                },
                "required": [
                  "pct",
                  "tolerance_pct",
                  "noise_pct",
                  "noise_basis",
                  "noise_daily",
                  "capped",
                  "rule"
                ]
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "agree",
                  "above",
                  "below",
                  "no_baseline"
                ]
              }
            },
            "required": [
              "absolute",
              "percent",
              "band",
              "verdict"
            ]
          },
          "signals": {
            "type": "object",
            "properties": {
              "trend": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "rising": {
                    "type": "boolean",
                    "description": "At least one live finding says demand for the style is rising"
                  },
                  "fading": {
                    "type": "boolean",
                    "description": "At least one says a trait it carries is late-cycle or fading"
                  },
                  "signals": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "The finding"
                        },
                        "detector": {
                          "type": "string"
                        },
                        "direction": {
                          "type": "string",
                          "enum": [
                            "rising",
                            "fading"
                          ]
                        },
                        "headline": {
                          "type": "string"
                        },
                        "severity": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "low, medium, high or critical"
                        }
                      },
                      "required": [
                        "id",
                        "detector",
                        "direction",
                        "headline",
                        "severity"
                      ]
                    },
                    "description": "The findings behind it, most severe first, at most 3"
                  },
                  "source": {
                    "const": "trends"
                  }
                },
                "required": [
                  "rising",
                  "fading",
                  "signals",
                  "source"
                ],
                "description": "Current trend findings for the item's style; null when the organization has no trend findings"
              },
              "demand_drivers": {
                "type": "object",
                "properties": {
                  "count": {
                    "type": "integer",
                    "description": "Every event that bears on the row"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "The event: `id` of GET /v1/disruptions"
                        },
                        "source": {
                          "const": "disruptions",
                          "description": "Where to read the event"
                        },
                        "title": {
                          "type": "string"
                        },
                        "event_type": {
                          "type": "string"
                        },
                        "severity": {
                          "type": "integer",
                          "description": "1 (minor) to 5 (severe)"
                        },
                        "starts_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "ends_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "match": {
                          "type": "string",
                          "enum": [
                            "radius",
                            "country"
                          ],
                          "description": "How the event reaches the location: inside its radius, or in one of its countries"
                        },
                        "distance_km": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "From the location to the event; null for a country match"
                        }
                      },
                      "required": [
                        "id",
                        "source",
                        "title",
                        "event_type",
                        "severity",
                        "starts_at",
                        "ends_at",
                        "match",
                        "distance_km"
                      ]
                    },
                    "description": "The most severe, at most 10"
                  }
                },
                "required": [
                  "count",
                  "events"
                ],
                "description": "Demand-moving events in the period that reach the location and concern the item's category"
              },
              "calendar": {
                "type": "object",
                "properties": {
                  "count": {
                    "type": "integer",
                    "description": "Every holiday and calendar event in the period"
                  },
                  "holidays": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "country_code": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2"
                        },
                        "source": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name",
                        "date",
                        "country_code",
                        "source"
                      ]
                    },
                    "description": "Public holidays of the location's country in the period, at most 10"
                  },
                  "org_events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "region": {
                          "type": "string"
                        },
                        "source": {
                          "const": "calendar"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "date",
                        "region",
                        "source"
                      ]
                    },
                    "description": "Your own calendar events in the period, at most 10"
                  }
                },
                "required": [
                  "count",
                  "holidays",
                  "org_events"
                ]
              },
              "supply": {
                "type": "object",
                "properties": {
                  "disrupted": {
                    "type": "boolean",
                    "description": "Whether a current supply-risk event reaches one of the item's suppliers"
                  },
                  "countries": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Countries of the suppliers it reaches"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "title": {
                          "type": "string"
                        },
                        "severity": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "1 (minor) to 5 (severe)"
                        },
                        "countries": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "id",
                        "title",
                        "severity",
                        "countries"
                      ]
                    },
                    "description": "The current events behind it, most severe first"
                  },
                  "source": {
                    "const": "disruptions"
                  }
                },
                "required": [
                  "disrupted",
                  "countries",
                  "events",
                  "source"
                ],
                "description": "The current state of supply for the item, not a forecast for the period"
              }
            },
            "required": [
              "trend",
              "demand_drivers",
              "calendar",
              "supply"
            ]
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "their_forecast_below_baseline_while_trend_rising",
                "their_forecast_above_baseline_while_trend_fading",
                "demand_driver_in_period",
                "calendar_event_in_period",
                "supply_exposed"
              ]
            }
          }
        },
        "required": [
          "index",
          "ref",
          "item",
          "location",
          "period",
          "quantity",
          "status",
          "history",
          "baseline",
          "baseline_reason",
          "difference",
          "signals",
          "flags"
        ]
      },
      "ForecastCheckRowError": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "The row's position in the request (0-based)"
          },
          "ref": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "The row's `ref` as sent; null when none was sent or the row came from a stored forecast"
          },
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "location": {
            "type": "string",
            "description": "Location external id"
          },
          "period": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string",
                "format": "date"
              },
              "end": {
                "type": "string",
                "format": "date",
                "description": "The period's last day"
              },
              "days": {
                "type": "integer"
              }
            },
            "required": [
              "start",
              "end",
              "days"
            ]
          },
          "quantity": {
            "type": "number",
            "description": "Your forecast for the whole period"
          },
          "status": {
            "const": "error"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unknown_item",
                  "unknown_location",
                  "period_in_past",
                  "period_beyond_horizon"
                ]
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "index",
          "ref",
          "item",
          "location",
          "period",
          "quantity",
          "status",
          "error"
        ]
      },
      "ForecastEvaluation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "computed_at": {
            "type": "string",
            "format": "date-time"
          },
          "age_hours": {
            "type": "number"
          },
          "stale": {
            "type": "boolean",
            "description": "True when the figures are more than 8 days old"
          },
          "history": {
            "type": "object",
            "properties": {
              "from": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "weeks": {
                "type": "integer"
              },
              "capped": {
                "type": "boolean",
                "description": "True when the account may hold more history than was read"
              },
              "calendar_from": {
                "type": "string",
                "format": "date"
              },
              "calendar_weeks": {
                "type": "integer"
              }
            },
            "required": [
              "from",
              "to",
              "weeks",
              "capped",
              "calendar_from",
              "calendar_weeks"
            ]
          },
          "origins": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer"
              },
              "from": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "to": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              }
            },
            "required": [
              "count",
              "from",
              "to"
            ]
          },
          "horizon_weeks": {
            "type": "integer"
          },
          "min_history_weeks": {
            "type": "integer"
          },
          "min_scored_origins": {
            "type": "integer"
          },
          "pairs": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "scored": {
                "type": "integer"
              },
              "insufficient_history": {
                "type": "integer"
              }
            },
            "required": [
              "total",
              "scored",
              "insufficient_history"
            ],
            "description": "Item-location pairs"
          },
          "items": {
            "type": "integer"
          },
          "levels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "levels_skipped": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Levels that were not computed, each with why"
          },
          "method": {
            "type": "object",
            "properties": {
              "forecast": {
                "type": "string",
                "description": "What was scored, in words"
              },
              "benchmarks": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The benchmarks beside it: naive, seasonal_naive"
              },
              "scaled_error": {
                "type": "string",
                "description": "The scaled error the rows are ranked by: rmsse"
              },
              "demand_history": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "daily_demand",
                  "order_lines",
                  null
                ],
                "description": "Which demand history was read, as demand_source.source elsewhere; null when not recorded"
              }
            },
            "required": [
              "forecast",
              "benchmarks",
              "scaled_error",
              "demand_history"
            ],
            "description": "How the figures were measured"
          },
          "data_as_of": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "computed_at",
          "age_hours",
          "stale",
          "history",
          "origins",
          "horizon_weeks",
          "min_history_weeks",
          "min_scored_origins",
          "pairs",
          "items",
          "levels",
          "levels_skipped",
          "method",
          "data_as_of"
        ]
      },
      "ImportTax": {
        "type": "object",
        "properties": {
          "country_code": {
            "type": "string"
          },
          "country_name": {
            "type": "string"
          },
          "standard_vat_rate": {
            "type": "number",
            "description": "The standard import VAT / GST rate, in percent"
          },
          "reduced_rates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rate": {
                  "type": "number",
                  "description": "Percent"
                },
                "categories": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Product categories the rate covers"
                }
              },
              "required": [
                "rate",
                "categories"
              ]
            }
          },
          "import_vat_applies": {
            "type": "boolean",
            "description": "Whether the country charges VAT / GST on imports"
          },
          "vat_on_duty": {
            "type": "boolean",
            "description": "Whether duty is part of the amount VAT is charged on"
          },
          "exemptions": {
            "type": "array",
            "items": {},
            "description": "Exemptions on file for the country; empty for every country today"
          },
          "registration_threshold": {
            "type": [
              "number",
              "null"
            ],
            "description": "Turnover above which an importer must register for VAT, in the country's currency; null when not on file"
          },
          "currency": {
            "type": "string",
            "description": "The country's currency code"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "rate_status": {
            "type": "string",
            "enum": [
              "official",
              "unverified"
            ],
            "description": "official: the standard rate was read from the authority's own publication, or is fixed in a statute; unverified: a rate on file that has not been checked against a source"
          },
          "verified_on": {
            "type": [
              "string",
              "null"
            ],
            "description": "The day the rate was last checked against its source (YYYY-MM-DD); null for an unverified rate"
          },
          "vat_calculation": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "goods_value": {
                "type": "number"
              },
              "duty_amount": {
                "type": "number",
                "description": "The duty you sent; 0 when none"
              },
              "taxable_base": {
                "type": "number",
                "description": "The amount VAT is charged on"
              },
              "vat_rate_percent": {
                "type": "number"
              },
              "vat_amount": {
                "type": "number"
              },
              "total_with_vat": {
                "type": "number",
                "description": "Goods value plus duty plus VAT"
              },
              "note": {
                "type": "string",
                "description": "What the taxable base includes"
              }
            },
            "required": [
              "goods_value",
              "duty_amount",
              "taxable_base",
              "vat_rate_percent",
              "vat_amount",
              "total_with_vat",
              "note"
            ],
            "description": "The VAT on your shipment; null when goods_value was not sent"
          },
          "hs_code": {
            "type": "string",
            "description": "The HS code you sent, digits"
          },
          "zero_rated": {
            "type": "object",
            "properties": {
              "hs_prefix": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "conditions": {
                "type": "string"
              },
              "statute": {
                "type": "string"
              },
              "guidance": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_url": {
                "type": "string"
              },
              "guidance_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checked_on": {
                "type": "string",
                "format": "date"
              }
            },
            "required": [
              "hs_prefix",
              "description",
              "conditions",
              "statute",
              "guidance",
              "source_url",
              "guidance_url",
              "checked_on"
            ],
            "description": "CA, with hs_code: the goods are zero-rated basic groceries and pay no GST on import (vat_calculation uses 0%); the statute that says so"
          },
          "duration_ms": {
            "type": "integer"
          },
          "disclaimer": {
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "description": "Quote this when asking about the request; also the X-Request-ID header"
          }
        },
        "required": [
          "country_code",
          "country_name",
          "standard_vat_rate",
          "reduced_rates",
          "import_vat_applies",
          "vat_on_duty",
          "exemptions",
          "registration_threshold",
          "currency",
          "notes",
          "source_url",
          "rate_status",
          "verified_on",
          "vat_calculation",
          "duration_ms",
          "disclaimer",
          "request_id"
        ]
      },
      "IngestEntityCounts": {
        "type": "object",
        "properties": {
          "received": {
            "type": "integer",
            "description": "Records of the entity that arrived"
          },
          "upserted": {
            "type": "integer",
            "description": "Records stored (created or updated)"
          },
          "failed": {
            "type": "integer",
            "description": "Records refused or not stored"
          }
        },
        "required": [
          "received",
          "upserted",
          "failed"
        ]
      },
      "IngestRecordError": {
        "type": "object",
        "properties": {
          "entity": {
            "type": "string",
            "description": "The entity the record was sent under"
          },
          "index": {
            "type": "integer",
            "description": "The record's position in that entity's array, from 0"
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The record's external_id, when it had one"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "field",
                "message"
              ]
            }
          }
        },
        "required": [
          "entity",
          "index",
          "external_id",
          "errors"
        ]
      },
      "InventoryDemandStats": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": "string",
            "description": "Location external id"
          },
          "windowDays": {
            "type": "integer"
          },
          "totalQuantity": {
            "type": "number"
          },
          "nonZeroDays": {
            "type": "integer",
            "description": "Days in the window with any demand"
          },
          "meanDaily": {
            "type": "number"
          },
          "stdDevDaily": {
            "type": "number"
          },
          "cv": {
            "type": "number",
            "description": "Coefficient of variation of daily demand; 0 without demand"
          },
          "adi": {
            "type": [
              "number",
              "null"
            ],
            "description": "Average days between days with demand; null without demand"
          },
          "classification": {
            "type": "string",
            "enum": [
              "steady",
              "variable",
              "intermittent",
              "lumpy",
              "no_demand"
            ],
            "description": "The demand pattern over the window"
          }
        },
        "required": [
          "item",
          "description",
          "location",
          "windowDays",
          "totalQuantity",
          "nonZeroDays",
          "meanDaily",
          "stdDevDaily",
          "cv",
          "adi",
          "classification"
        ]
      },
      "InventoryExpiryAction": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "transfer",
              "markdown"
            ]
          },
          "itemExternalId": {
            "type": "string"
          },
          "fromLocationExternalId": {
            "type": "string",
            "description": "The location the stock leaves (transfer only)"
          },
          "toLocationExternalId": {
            "type": "string",
            "description": "The location that receives the stock, or where it is marked down"
          },
          "quantity": {
            "type": "number"
          },
          "rescuedValue": {
            "type": [
              "number",
              "null"
            ],
            "description": "Units moved at unit cost; null for a markdown or an item without cost"
          },
          "markdownPct": {
            "type": "number",
            "description": "Suggested discount in percent (markdown only)"
          },
          "priority": {
            "type": "number",
            "description": "0-100, higher first"
          },
          "rationale": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string"
              },
              "days_to_expiry": {
                "type": "integer"
              },
              "transfer_window_days": {
                "type": "integer",
                "description": "Days the receiving location has to sell the stock (transfer only)"
              },
              "unmovable_units": {
                "type": "number",
                "description": "Units no location can sell in time (markdown only)"
              }
            },
            "required": [
              "reason",
              "days_to_expiry"
            ]
          }
        },
        "required": [
          "type",
          "itemExternalId",
          "toLocationExternalId",
          "quantity",
          "rescuedValue",
          "priority",
          "rationale"
        ]
      },
      "InventoryExpiryRisk": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": "string",
            "description": "Location external id"
          },
          "mean_daily_demand": {
            "type": "number"
          },
          "total_at_risk_units": {
            "type": "number"
          },
          "total_at_risk_value": {
            "type": [
              "number",
              "null"
            ],
            "description": "At-risk units at unit cost; null when the item has no cost"
          },
          "lots": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lotCode": {
                  "type": "string"
                },
                "expiryDate": {
                  "type": "string",
                  "format": "date"
                },
                "daysToExpiry": {
                  "type": "integer",
                  "description": "Negative when already expired"
                },
                "onHand": {
                  "type": "number"
                },
                "projectedSold": {
                  "type": "number",
                  "description": "Units expected to sell before the lot expires"
                },
                "atRiskUnits": {
                  "type": "number",
                  "description": "Units expected to expire unsold"
                },
                "atRiskValue": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "expired",
                    "critical",
                    "at_risk",
                    "ok"
                  ]
                }
              },
              "required": [
                "lotCode",
                "expiryDate",
                "daysToExpiry",
                "onHand",
                "projectedSold",
                "atRiskUnits",
                "atRiskValue",
                "status"
              ]
            }
          }
        },
        "required": [
          "item",
          "description",
          "location",
          "mean_daily_demand",
          "total_at_risk_units",
          "total_at_risk_value",
          "lots"
        ]
      },
      "InventoryForecast": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": "string",
            "description": "Location external id"
          },
          "classification": {
            "type": "string",
            "enum": [
              "steady",
              "variable",
              "intermittent",
              "lumpy",
              "no_demand"
            ],
            "description": "The demand pattern over the window"
          },
          "method": {
            "type": "string",
            "enum": [
              "smoothed_weekday",
              "intermittent",
              "none"
            ],
            "description": "How the forecast was computed. smoothed_weekday: smoothed demand with a weekday pattern. intermittent: for demand that arrives on few days. none: no demand to forecast"
          },
          "history_mean_daily": {
            "type": "number"
          },
          "forecast_daily_rate": {
            "type": "number"
          },
          "forecast_horizon_total": {
            "type": "number",
            "description": "Forecast units over the horizon"
          },
          "in_sample_mae": {
            "type": [
              "number",
              "null"
            ],
            "description": "Mean absolute error per day on history; null when the method reports none"
          },
          "day_of_week_indices": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "number"
            },
            "description": "Seven day-of-week factors, starting at the first forecast day; null when not used"
          }
        },
        "required": [
          "item",
          "description",
          "location",
          "classification",
          "method",
          "history_mean_daily",
          "forecast_daily_rate",
          "forecast_horizon_total",
          "in_sample_mae",
          "day_of_week_indices"
        ]
      },
      "InventoryPurchaseProposal": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": "number"
          },
          "priority": {
            "type": "number",
            "description": "0-100, higher first"
          },
          "suggested_supplier": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "external_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "country_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lead_time_days": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "disruption_affected": {
                "type": "boolean",
                "description": "The supplier's country has an active supply-risk event"
              }
            },
            "required": [
              "external_id",
              "name",
              "country_code",
              "lead_time_days",
              "disruption_affected"
            ]
          },
          "rationale": {
            "type": "object",
            "properties": {
              "network_on_hand": {
                "type": "number",
                "description": "On hand across every location"
              },
              "inbound_quantity": {
                "type": "number",
                "description": "Open inbound across every purchase order"
              },
              "network_position": {
                "type": "number",
                "description": "On hand plus inbound"
              },
              "mean_daily_demand": {
                "type": "number"
              },
              "lead_time_days": {
                "type": "number"
              },
              "safety_stock": {
                "type": "number"
              },
              "reorder_point": {
                "type": "number"
              },
              "order_up_to_level": {
                "type": "number"
              },
              "network_days_of_cover": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "estimated_value": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Quantity at unit cost; null when the item has no cost"
              },
              "supplier_disruption_affected": {
                "type": "boolean"
              },
              "alternate_suppliers": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Up to three other suppliers of the item (external ids)"
              },
              "supplier_slip": {
                "$ref": "#/components/schemas/SupplierDeliverySlip"
              },
              "lead_time_source": {
                "type": "string",
                "enum": [
                  "observed",
                  "stated",
                  "supplier_master",
                  "default",
                  "master_data",
                  "none"
                ]
              },
              "lead_time_sample": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Receipts behind an observed lead time"
              },
              "lead_time_p90_days": {
                "type": "number"
              },
              "lead_time_std_dev_days": {
                "type": "number"
              },
              "supplier_lead_time_days": {
                "type": "number"
              },
              "order_wait_days": {
                "type": "number",
                "description": "Days until the supplier's next order day"
              },
              "next_order_date": {
                "type": "string",
                "format": "date"
              },
              "expected_arrival_date": {
                "type": "string",
                "format": "date"
              },
              "suppliers_closed": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Suppliers left out because they take no order in the next year"
              },
              "supplier_calendar_invalid": {
                "type": "boolean"
              },
              "review_period_days": {
                "type": "number"
              },
              "compliance_excluded_suppliers": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Suppliers left out because a purchase from them would not be allowed"
              },
              "min_order_qty": {
                "type": "number"
              },
              "order_multiple": {
                "type": "number"
              },
              "quantity_before_rules": {
                "type": "number",
                "description": "The quantity before the minimum order quantity and the order multiple"
              },
              "adjustments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "rule": {
                      "type": "string",
                      "enum": [
                        "pack",
                        "min_order_qty",
                        "cap"
                      ]
                    },
                    "from": {
                      "type": "number"
                    },
                    "to": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "rule",
                    "from",
                    "to"
                  ],
                  "description": "One rule that changed the quantity"
                }
              },
              "service_level": {
                "type": "number"
              },
              "parameters": {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/components/schemas/PlanningParameterValue"
                },
                "description": "The planning parameters behind the row, by parameter key (inventory.service_level, inventory.review_period_days, ...)"
              },
              "inbound_supplier_updates": {
                "type": "object",
                "properties": {
                  "inbound_quantity_from_orders": {
                    "type": "number"
                  },
                  "inbound_quantity_used": {
                    "type": "number"
                  },
                  "changes": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/SupplierInboundChange"
                    }
                  }
                },
                "required": [
                  "inbound_quantity_from_orders",
                  "inbound_quantity_used",
                  "changes"
                ],
                "description": "Present when the supplier network changed the item's inbound"
              }
            },
            "required": [
              "network_on_hand",
              "inbound_quantity",
              "network_position",
              "mean_daily_demand",
              "lead_time_days",
              "safety_stock",
              "reorder_point",
              "order_up_to_level",
              "network_days_of_cover",
              "estimated_value",
              "supplier_disruption_affected",
              "alternate_suppliers"
            ],
            "description": "The figures behind the proposal; a figure that did not apply is absent"
          }
        },
        "required": [
          "item",
          "description",
          "quantity",
          "priority",
          "suggested_supplier",
          "rationale"
        ]
      },
      "InventoryReplenishmentParams": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "location": {
            "type": "string",
            "description": "Location external id"
          },
          "classification": {
            "type": "string",
            "enum": [
              "steady",
              "variable",
              "intermittent",
              "lumpy",
              "no_demand"
            ],
            "description": "The demand pattern over the window"
          },
          "mean_daily_demand": {
            "type": "number"
          },
          "demand_std_dev": {
            "type": "number"
          },
          "lead_time_days": {
            "type": "number"
          },
          "lead_time_source": {
            "type": "string",
            "enum": [
              "observed",
              "stated",
              "supplier_master",
              "default"
            ],
            "description": "Where the lead time comes from: receipts observed, the account's own figure, the supplier's master data, or the fallback"
          },
          "service_level": {
            "type": "number"
          },
          "safety_stock": {
            "type": "number"
          },
          "reorder_point": {
            "type": "number"
          },
          "on_hand": {
            "type": "number"
          },
          "below_reorder_point": {
            "type": "boolean"
          },
          "review_period_days": {
            "type": "number"
          },
          "order_up_to_level": {
            "type": "number"
          },
          "suggested_order_qty": {
            "type": "number"
          },
          "above_max_after_rounding": {
            "type": "boolean",
            "description": "True when rounding to the order constraints takes the stock above max_stock"
          },
          "min_stock": {
            "type": "number"
          },
          "max_stock": {
            "type": [
              "number",
              "null"
            ]
          },
          "presentation_min": {
            "type": "number"
          },
          "order_constraints": {
            "type": "object",
            "properties": {
              "min_order_qty": {
                "type": "number"
              },
              "order_multiple": {
                "type": "number"
              },
              "case_pack": {
                "type": "number"
              }
            },
            "required": [
              "min_order_qty",
              "order_multiple",
              "case_pack"
            ]
          },
          "lead_time": {
            "type": "object",
            "properties": {
              "days": {
                "type": "number"
              },
              "source": {
                "type": "string",
                "enum": [
                  "observed",
                  "stated",
                  "supplier_master",
                  "default"
                ],
                "description": "Where the lead time comes from: receipts observed, the account's own figure, the supplier's master data, or the fallback"
              },
              "supplier_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid",
                "description": "The supplier whose lead time it is; null for the fallback"
              },
              "statistic": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "p50",
                  "p90",
                  null
                ]
              },
              "level": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "supplier_plant",
                  "supplier",
                  null
                ]
              },
              "sample": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Receipts observed"
              },
              "min_sample": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "p50_days": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "p90_days": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "master_days": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The supplier's own lead time on file"
              },
              "parameter": {
                "$ref": "#/components/schemas/PlanningParameterValue"
              }
            },
            "required": [
              "days",
              "source",
              "supplier_id",
              "master_days"
            ],
            "description": "The lead time and its evidence; statistic, level, sample and the percentiles only when it was observed, parameter when a parameter value gave it"
          },
          "parameters": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/PlanningParameterValue"
            },
            "description": "The planning parameters behind the row, by parameter key (inventory.service_level, inventory.review_period_days, ...)"
          }
        },
        "required": [
          "item",
          "location",
          "classification",
          "mean_daily_demand",
          "demand_std_dev",
          "lead_time_days",
          "lead_time_source",
          "service_level",
          "safety_stock",
          "reorder_point",
          "on_hand",
          "below_reorder_point",
          "review_period_days",
          "order_up_to_level",
          "suggested_order_qty",
          "above_max_after_rounding",
          "min_stock",
          "max_stock",
          "presentation_min",
          "order_constraints",
          "lead_time",
          "parameters"
        ]
      },
      "InventoryResultSource": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "source": {
                "const": "stored"
              },
              "result_id": {
                "type": "string",
                "format": "uuid",
                "description": "The id of the stored results the answer was read from"
              },
              "computed_at": {
                "type": "string",
                "format": "date-time"
              },
              "published_at": {
                "type": "string",
                "format": "date-time"
              },
              "age_hours": {
                "type": "number"
              },
              "stale": {
                "type": "boolean",
                "description": "True when the stored results are more than 36 hours old (they are still served)"
              }
            },
            "required": [
              "source",
              "result_id",
              "computed_at",
              "published_at",
              "age_hours",
              "stale"
            ],
            "description": "Read from the latest stored results"
          },
          {
            "type": "object",
            "properties": {
              "source": {
                "const": "on_request"
              },
              "reason": {
                "type": "string",
                "enum": [
                  "no_stored_result",
                  "settings_differ",
                  "parameters_changed",
                  "item_filter",
                  "stored_result_unavailable",
                  "not_stored"
                ],
                "description": "Why stored results did not answer. no_stored_result: there are none yet. settings_differ, parameters_changed: they were computed with other settings or parameters than this request. item_filter: one item was asked for. stored_result_unavailable: they could not be read. not_stored: this route is always computed for the request"
              }
            },
            "required": [
              "source",
              "reason"
            ],
            "description": "Computed for this request"
          }
        ]
      },
      "InventoryStockoutProjection": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": "string",
            "description": "Location external id"
          },
          "on_hand": {
            "type": "number"
          },
          "mean_daily_demand": {
            "type": "number"
          },
          "stockout_in_days": {
            "type": [
              "number",
              "null"
            ],
            "description": "Days until the projected stockout, inbound counted; null when none within 60 days"
          },
          "stockout_without_inbound_days": {
            "type": [
              "number",
              "null"
            ]
          },
          "rescued_by_inbound": {
            "type": "boolean",
            "description": "True when inbound prevents or delays the stockout"
          },
          "uncovered_gap_days": {
            "type": "number",
            "description": "Days without stock between the stockout and the next arrival; 0 when there is no stockout"
          },
          "first_arrival_in_days": {
            "type": [
              "number",
              "null"
            ]
          },
          "supplier_updates": {
            "type": "object",
            "properties": {
              "stockout_in_days_from_orders": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The projection on the purchase orders alone"
              },
              "stockout_in_days": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "moved": {
                "type": "string",
                "enum": [
                  "unchanged",
                  "stockout_appears",
                  "stockout_avoided",
                  "earlier",
                  "later"
                ]
              },
              "uncovered_gap_days_from_orders": {
                "type": "number"
              },
              "changes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SupplierInboundChange"
                }
              }
            },
            "required": [
              "stockout_in_days_from_orders",
              "stockout_in_days",
              "moved",
              "uncovered_gap_days_from_orders",
              "changes"
            ],
            "description": "Present when ship notices, predicted arrivals or accepted supplier answers changed the pair's inbound"
          }
        },
        "required": [
          "item",
          "description",
          "location",
          "on_hand",
          "mean_daily_demand",
          "stockout_in_days",
          "stockout_without_inbound_days",
          "rescued_by_inbound",
          "uncovered_gap_days",
          "first_arrival_in_days"
        ]
      },
      "LandedCost": {
        "type": "object",
        "properties": {
          "hs_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The code costed: yours, the classified one, or the line it resolved to"
          },
          "hs_classification_source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "catalog",
              "estimated",
              "schedule",
              null
            ],
            "description": "With item_description: how the code was found. catalog: a reviewed match. schedule: a line of the tariff schedule matched by rule. estimated: classified from the description"
          },
          "origin_country": {
            "type": "string"
          },
          "destination_country": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "description": "Currency of every amount: USD, the currency your values are read in; CAD for Canada, AED for the UAE, SAR for Saudi Arabia and EGP for Egypt, converted at exchange_rate"
          },
          "quantity": {
            "type": "integer"
          },
          "shipment_date": {
            "type": "string",
            "format": "date",
            "description": "CA, AE, SA and EG: the day the rates are for"
          },
          "exchange_rate": {
            "type": "object",
            "properties": {
              "base": {
                "type": "string",
                "description": "USD: the currency your values are read in"
              },
              "quote": {
                "type": "string",
                "description": "CAD, AED, SAR or EGP"
              },
              "rate": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Units of the quote currency per USD; null when amounts were sent in CAD and no rate is on file"
              },
              "rate_date": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date",
                "description": "The day of the published rate: the shipment date, or the business day before it. null for AED and SAR, which are pegged to the dollar at a fixed official rate. EGP: the day the Egyptian customs conversion rate was read"
              },
              "source": {
                "type": "string"
              },
              "source_url": {
                "type": "string"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "When the rate is not the shipment date's own: why"
              },
              "input_amounts": {
                "type": "object",
                "properties": {
                  "currency": {
                    "type": "string"
                  },
                  "goods_value": {
                    "type": "number"
                  },
                  "freight_cost": {
                    "type": "number"
                  },
                  "insurance_cost": {
                    "type": "number"
                  }
                },
                "required": [
                  "currency",
                  "goods_value",
                  "freight_cost",
                  "insurance_cost"
                ],
                "description": "Your values as sent, before conversion"
              },
              "total_landed_cost_usd": {
                "type": "number",
                "description": "CA with currency CAD: the total in USD at the rate shown"
              }
            },
            "required": [
              "base",
              "quote",
              "rate",
              "rate_date",
              "source",
              "source_url",
              "note",
              "input_amounts"
            ],
            "description": "CA, AE, SA and EG: the rate every amount was converted at"
          },
          "entry": {
            "type": "object",
            "properties": {
              "channel": {
                "type": "string"
              },
              "transport_mode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "import_zone": {
                "type": "string"
              },
              "personal_import": {
                "type": "boolean"
              },
              "bond": {
                "type": "string"
              }
            },
            "required": [
              "transport_mode"
            ],
            "description": "AE and SA: how the goods enter, as the request stated or by default. US: the bond and transport mode the fees were computed for"
          },
          "de_minimis_source": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "url"
            ],
            "description": "AE and SA only: the notice or rule behind a low-value duty exemption that applied"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What else to know. AE, SA and EG: a parcel exemption that did not apply, and why; Egypt's advance cargo filing. US: the fees left out (no harbor fee without transport_mode ocean, no bond cost without bond single_entry)"
          },
          "de_minimis_applied": {
            "type": "boolean",
            "description": "true when the shipment enters duty-free under the destination's low-value threshold; duty and fees are then 0"
          },
          "de_minimis_note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why a low-value shipment still pays duty; null when the threshold does not come into it"
          },
          "cost_breakdown": {
            "type": "object",
            "properties": {
              "goods_value": {
                "type": "number"
              },
              "freight_cost": {
                "type": "number"
              },
              "insurance_cost": {
                "type": "number"
              },
              "cif_value": {
                "type": "number",
                "description": "Goods value plus freight plus insurance: what the goods cost landed, before duty, fees and tax"
              },
              "customs_value": {
                "type": "number",
                "description": "The value duty, trade remedies and percentage fees are charged on. For the US and Canada the goods value alone; for the UK and the EU it includes freight and insurance"
              },
              "valuation_basis": {
                "type": "string",
                "enum": [
                  "fob",
                  "cif"
                ],
                "description": "fob: the customs value is the goods value; cif: it includes freight and insurance"
              },
              "valuation_note": {
                "type": "string",
                "description": "One sentence saying what this destination charges duty on"
              },
              "duty_rate_percent": {
                "type": "number",
                "description": "The duty rate charged, percent of customs_value: yours when you sent duty_rate_percent, else the looked-up one"
              },
              "duty_amount": {
                "type": "number"
              },
              "surtax_amount": {
                "type": "number",
                "description": "CA only: the part of duty_amount that is Canada's surtax on US goods"
              },
              "excise_tax": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "computed",
                      "not_applicable",
                      "not_computed"
                    ],
                    "description": "not_computed: the code is one of excise goods but the request did not state what excise is charged on, so it is not in the total"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "basis": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "How the amount was reached, or why it was not"
                  },
                  "source": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "source_url": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "status",
                  "amount",
                  "basis",
                  "source",
                  "source_url"
                ],
                "description": "AE and SA only: excise tax on excise goods"
              },
              "adcvd_duty_amount": {
                "type": "number",
                "description": "Anti-dumping and countervailing duty; 0 when no order applies (and for Canada, whose measures publish no rate)"
              },
              "duty_basis": {
                "type": "string",
                "description": "EG only: how a duty with a per-unit part was reached (the amount per unit times the quantity sent in measures)"
              },
              "duty_per_unit_amount": {
                "type": "number",
                "description": "EG only: the per-unit part of duty_amount"
              },
              "other_taxes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "tax": {
                      "type": "string",
                      "enum": [
                        "vat",
                        "table_tax",
                        "other"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "name_local": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The tax's name in Arabic, as published"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "computed",
                        "not_computed"
                      ],
                      "description": "not_computed: the line states the tax per unit or as a minimum and the request did not send the quantity (measures), or it states a percentage with no base; it is not in the total"
                    },
                    "rate": {
                      "type": "string",
                      "description": "The rate as the tariff line states it"
                    },
                    "rate_percent": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "basis": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "What a computed tax was charged on"
                    },
                    "taxable_base": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "amount": {
                      "type": "number"
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Why a tax was not computed"
                    }
                  },
                  "required": [
                    "tax",
                    "name",
                    "name_local",
                    "status",
                    "rate",
                    "rate_percent",
                    "basis",
                    "taxable_base",
                    "amount",
                    "note"
                  ]
                },
                "description": "EG only: the other taxes the tariff line states beside VAT (a table tax, levies), each computed on the base the line states or named as not computed"
              },
              "total_other_taxes": {
                "type": "number",
                "description": "EG only: the computed other_taxes, summed"
              },
              "not_included": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "EG only: what the total leaves out, one sentence each (taxes charged per unit, fees whose amount the tariff does not settle, the customs service fees)"
              },
              "fees": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "fee_name": {
                      "type": "string"
                    },
                    "fee_code": {
                      "type": "string"
                    },
                    "amount": {
                      "type": "number",
                      "description": "In the response's currency"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "fee_name",
                    "fee_code",
                    "amount",
                    "description"
                  ]
                },
                "description": "The destination's import fees that apply, by fee code"
              },
              "total_fees": {
                "type": "number"
              },
              "import_vat": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "rate_percent": {
                    "type": "number"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "destination_country_name": {
                    "type": "string"
                  },
                  "destination_currency": {
                    "type": "string",
                    "description": "The destination's currency code (the amount itself is in the response's currency)"
                  },
                  "rate_source": {
                    "type": "string",
                    "enum": [
                      "tariff_line",
                      "country_standard_rate"
                    ],
                    "description": "tariff_line: the rate published for this tariff line; country_standard_rate: the destination's standard rate"
                  },
                  "taxable_base": {
                    "type": "number",
                    "description": "CA, AE, SA and EG: the amount the tax is charged on"
                  },
                  "tax_name": {
                    "type": "string",
                    "description": "CA: GST. AE, SA and EG: VAT"
                  },
                  "note": {
                    "type": "string",
                    "description": "CA, AE, SA and EG: what the tax is charged on"
                  },
                  "zero_rated": {
                    "type": "object",
                    "properties": {
                      "hs_prefix": {
                        "type": "string"
                      },
                      "statute": {
                        "type": "string"
                      },
                      "guidance": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "source_url": {
                        "type": "string"
                      },
                      "guidance_url": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "checked_on": {
                        "type": "string",
                        "format": "date"
                      },
                      "standard_rate_percent": {
                        "type": "number",
                        "description": "The rate the goods would pay if they were not zero-rated"
                      }
                    },
                    "required": [
                      "hs_prefix",
                      "statute",
                      "guidance",
                      "source_url",
                      "guidance_url",
                      "checked_on",
                      "standard_rate_percent"
                    ],
                    "description": "CA only: the goods are zero-rated basic groceries, a non-taxable importation, so no GST is charged; the statute that says so"
                  },
                  "source": {
                    "type": "string",
                    "description": "AE, SA and EG: the law or tariff the rate and its base come from"
                  },
                  "source_url": {
                    "type": "string"
                  }
                },
                "required": [
                  "rate_percent",
                  "amount",
                  "destination_country_name",
                  "destination_currency",
                  "rate_source"
                ],
                "description": "Import VAT (GST for Canada); null for the US and where none is charged"
              }
            },
            "required": [
              "goods_value",
              "freight_cost",
              "insurance_cost",
              "cif_value",
              "customs_value",
              "valuation_basis",
              "valuation_note",
              "duty_rate_percent",
              "duty_amount",
              "adcvd_duty_amount",
              "fees",
              "total_fees",
              "import_vat"
            ]
          },
          "adcvd_orders": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TariffAdcvdOrders"
              },
              {
                "type": "null"
              }
            ]
          },
          "trade_remedy_measures": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TariffTradeRemedyMeasures",
                "description": "CA only: the anti-dumping and countervailing measures that cover the code and origin, without rates (not in the total)"
              },
              {
                "type": "null"
              }
            ]
          },
          "total_landed_cost": {
            "type": "number"
          },
          "per_unit_landed_cost": {
            "type": "number",
            "description": "total_landed_cost divided by quantity"
          },
          "tariff_source": {
            "type": "object",
            "properties": {
              "effective_rate_display": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The looked-up effective rate as text"
              },
              "effective_rate_mfn": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "effective_rate_preferential": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "base_rate": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TariffBaseRate"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "additional_duties": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TariffAdditionalDuty"
                }
              },
              "trade_agreement": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TariffTradeAgreement"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "confidence_score": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "With item_description: how sure the classification is, 0 to 1"
              },
              "duty_rate_source": {
                "type": "string",
                "enum": [
                  "manual_override",
                  "fta_preferential",
                  "tariff_lookup"
                ],
                "description": "Which rate was charged: yours, the origin's preferential rate, or the standard looked-up rate"
              },
              "duty_rate_status": {
                "type": "string",
                "enum": [
                  "official",
                  "estimated",
                  "manual",
                  "unverified",
                  "confirmed_by_you"
                ],
                "description": "manual: your own rate on this request; estimated: the tariff schedule was unavailable and the rate is an estimate; unverified: not the destination's own published rate (Saudi Arabia: the GCC common tariff's rate for the code); confirmed_by_you: the rate your organization saved for the code as confirmed"
              },
              "rate_note": {
                "type": "string",
                "description": "With duty_rate_status confirmed_by_you: which of your confirmed rates was charged, with the note and dates saved with it"
              },
              "excluded_specific_duty": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "A per-unit part of the duty that duty_amount does not include; null when there is none"
              },
              "rate_warning": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "What to know about the rate used: estimated, a per-unit part left out, no lookup ran, or a Section 232 duty that is a ceiling"
              },
              "metal_weight": {
                "type": "object",
                "properties": {
                  "basis": {
                    "type": "string",
                    "enum": [
                      "at_or_above_threshold",
                      "below_threshold",
                      "not_stated"
                    ],
                    "description": "not_stated: metal_weight_percent was not sent and the Section 232 heading was charged (a ceiling)"
                  },
                  "ceiling": {
                    "type": "boolean"
                  },
                  "metal_weight_percent": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "threshold_percent": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": [
                  "basis",
                  "ceiling",
                  "metal_weight_percent",
                  "threshold_percent",
                  "note"
                ],
                "description": "US, for a Section 232 derivative: how the metal-weight condition was applied"
              }
            },
            "required": [
              "effective_rate_display",
              "effective_rate_mfn",
              "effective_rate_preferential",
              "base_rate",
              "additional_duties",
              "trade_agreement",
              "confidence_score",
              "duty_rate_source",
              "duty_rate_status",
              "excluded_specific_duty",
              "rate_warning"
            ],
            "description": "The tariff lookup behind the duty rate"
          },
          "tariff_authority": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TariffSource",
                "description": "The tariff that answered the lookup; null when no lookup ran"
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_ms": {
            "type": "integer"
          },
          "disclaimer": {
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "description": "Quote this when asking about the request; also the X-Request-ID header"
          }
        },
        "required": [
          "hs_code",
          "hs_classification_source",
          "origin_country",
          "destination_country",
          "currency",
          "quantity",
          "de_minimis_applied",
          "de_minimis_note",
          "cost_breakdown",
          "adcvd_orders",
          "total_landed_cost",
          "per_unit_landed_cost",
          "tariff_source",
          "tariff_authority",
          "duration_ms",
          "disclaimer",
          "request_id"
        ]
      },
      "LocationRisk": {
        "type": "object",
        "properties": {
          "country_code": {
            "type": "string"
          },
          "country_name": {
            "type": "string",
            "description": "The country's name; the code itself when the country has no risk profile"
          },
          "risk_level": {
            "type": "string",
            "enum": [
              "LOW",
              "MEDIUM",
              "ELEVATED",
              "HIGH",
              "CRITICAL",
              "BLOCKED",
              "UNKNOWN"
            ],
            "description": "UNKNOWN: no risk profile for the country (not the same as low risk)"
          },
          "sanctioned": {
            "type": "boolean",
            "description": "Whether trade with the country itself is under a comprehensive or partial embargo"
          },
          "embargo_type": {
            "type": "string",
            "enum": [
              "none",
              "targeted",
              "partial",
              "comprehensive"
            ]
          },
          "sanctions_programs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "source_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "name",
                "source_url"
              ]
            }
          },
          "risk_factors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "One line per fact behind the risk level"
          },
          "recommended_action": {
            "type": "string",
            "enum": [
              "BLOCK",
              "REVIEW",
              "PROCEED"
            ]
          },
          "regulatory_context": {
            "type": "object",
            "properties": {
              "fatf_status": {
                "type": "string",
                "enum": [
                  "clear",
                  "greylist",
                  "blacklist"
                ],
                "description": "The country's standing on the international money-laundering watch lists"
              },
              "cpi_tier": {
                "type": "string",
                "enum": [
                  "very_low",
                  "low",
                  "medium",
                  "high",
                  "very_high",
                  "unknown"
                ],
                "description": "Band of the country's corruption perception score; high means clean"
              },
              "ear_group": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The country's US export-control country groups, comma-separated (e.g. A:1,B)"
              },
              "source_urls": {
                "type": "object",
                "properties": {
                  "fatf_status": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "cpi_tier": {
                    "type": "string"
                  },
                  "ear_group": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "fatf_status",
                  "cpi_tier",
                  "ear_group"
                ],
                "description": "A reference page for each field of this object; null when there is none"
              }
            },
            "required": [
              "fatf_status",
              "cpi_tier",
              "ear_group",
              "source_urls"
            ]
          },
          "duration_ms": {
            "type": "integer"
          },
          "request_id": {
            "type": "string",
            "description": "Quote this when asking about the request; also the X-Request-ID header"
          }
        },
        "required": [
          "country_code",
          "country_name",
          "risk_level",
          "sanctioned",
          "embargo_type",
          "sanctions_programs",
          "risk_factors",
          "recommended_action",
          "regulatory_context",
          "duration_ms",
          "request_id"
        ]
      },
      "MarkdownCandidate": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": "string",
            "description": "Location external id"
          },
          "on_hand": {
            "type": "number"
          },
          "last_selling_price": {
            "type": [
              "number",
              "null"
            ],
            "description": "Average selling price over the window; null without sales"
          },
          "projected_sales": {
            "type": "number",
            "description": "Units expected to sell before season end"
          },
          "projected_overhang_units": {
            "type": "number",
            "description": "Units expected to remain at season end"
          },
          "overhang_ratio": {
            "type": "number",
            "description": "Overhang as a fraction of on hand (0-1)"
          },
          "weeks_of_stock": {
            "type": [
              "number",
              "null"
            ]
          },
          "suggested_markdown_pct": {
            "type": "number",
            "description": "0, 10, 20, 30 or 40"
          },
          "overhang_value_at_cost": {
            "type": [
              "number",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "item",
          "description",
          "location",
          "on_hand",
          "last_selling_price",
          "projected_sales",
          "projected_overhang_units",
          "overhang_ratio",
          "weeks_of_stock",
          "suggested_markdown_pct",
          "overhang_value_at_cost",
          "reason"
        ]
      },
      "McpErrorEnvelope": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "The id of the request; null when it carried none or could not be read"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer",
                "description": "-32700 the body is not JSON, -32600 not a single JSON-RPC request, -32603 the request failed on our side"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "jsonrpc",
          "id",
          "error"
        ],
        "description": "A JSON-RPC 2.0 error response. The request id is the X-Request-ID header"
      },
      "McpInitializeResult": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "type": "string",
            "description": "The protocol version the server will speak: the one requested when it is supported, else the newest supported"
          },
          "capabilities": {
            "type": "object",
            "additionalProperties": true,
            "description": "tools, prompts and resources"
          },
          "serverInfo": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "title",
              "version"
            ]
          },
          "instructions": {
            "type": "string",
            "description": "Where to start, which toolset this connection lists, and how a cut result is continued, for the model"
          }
        },
        "required": [
          "protocolVersion",
          "capabilities",
          "serverInfo",
          "instructions"
        ]
      },
      "McpTool": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "description": "When to use the tool, what it returns, and what a call costs"
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true,
            "description": "The tool's arguments, as a JSON Schema"
          },
          "outputSchema": {
            "type": "object",
            "additionalProperties": true,
            "description": "The tool's structuredContent, as a JSON Schema: the top-level fields, or every field with ?schemas=full"
          },
          "annotations": {
            "type": "object",
            "properties": {
              "readOnlyHint": {
                "type": "boolean",
                "description": "false for a tool that stores or changes something"
              },
              "destructiveHint": {
                "type": "boolean",
                "description": "Write tools only: false when the tool only adds state"
              },
              "idempotentHint": {
                "type": "boolean",
                "description": "Write tools only"
              },
              "openWorldHint": {
                "type": "boolean",
                "description": "true when the answer comes from an outside source at call time"
              }
            },
            "required": [
              "readOnlyHint",
              "openWorldHint"
            ]
          }
        },
        "required": [
          "name",
          "title",
          "description",
          "inputSchema",
          "outputSchema",
          "annotations"
        ]
      },
      "McpToolsCallResult": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "const": "text"
                },
                "text": {
                  "type": "string",
                  "description": "The same JSON as structuredContent, as text; for a refused or failed call the error object as text, or a sentence"
                }
              },
              "required": [
                "type",
                "text"
              ]
            },
            "description": "One text item"
          },
          "structuredContent": {
            "type": "object",
            "additionalProperties": true,
            "description": "The tool's answer: the JSON its route returns, a list's rows once, cut to 32,000 bytes with `truncated`, `omitted` and `next_cursor` when it was larger. Absent when isError is true"
          },
          "isError": {
            "type": "boolean"
          }
        },
        "required": [
          "content",
          "isError"
        ]
      },
      "McpToolsListResult": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/McpTool"
            },
            "description": "The tools of the connected toolsets that the caller's organization is entitled to"
          }
        },
        "required": [
          "tools"
        ]
      },
      "MerchandisePlanCategory": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "description": "Upper case; UNCATEGORIZED for items without one"
          },
          "window_units_sold": {
            "type": "integer"
          },
          "window_revenue": {
            "type": "number"
          },
          "window_gross_margin": {
            "type": "number"
          },
          "margin_pct": {
            "type": [
              "number",
              "null"
            ]
          },
          "on_hand_units": {
            "type": "integer"
          },
          "inventory_value_at_cost": {
            "type": "number"
          },
          "window_gmroi": {
            "type": [
              "number",
              "null"
            ],
            "description": "Gross margin of the window over inventory at cost"
          },
          "gmroi_annualized": {
            "type": [
              "number",
              "null"
            ]
          },
          "weeks_of_supply": {
            "type": [
              "number",
              "null"
            ]
          },
          "plan_signal": {
            "type": "string",
            "enum": [
              "buy",
              "rebalance",
              "cut",
              "on_plan"
            ]
          },
          "plan_reason": {
            "type": "string"
          },
          "inbound_units": {
            "type": "integer"
          },
          "forecast_units": {
            "type": "integer"
          },
          "open_to_buy_units": {
            "type": "number",
            "description": "Units to buy over the horizon, summed per item"
          },
          "open_to_buy_value_at_cost": {
            "type": "number"
          }
        },
        "required": [
          "category",
          "window_units_sold",
          "window_revenue",
          "window_gross_margin",
          "margin_pct",
          "on_hand_units",
          "inventory_value_at_cost",
          "window_gmroi",
          "gmroi_annualized",
          "weeks_of_supply",
          "plan_signal",
          "plan_reason",
          "inbound_units",
          "forecast_units",
          "open_to_buy_units",
          "open_to_buy_value_at_cost"
        ]
      },
      "ModeShiftCandidate": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Send it back to propose"
          },
          "supplier": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "external_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "external_id",
              "name",
              "country"
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "external_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "external_id",
              "name",
              "country"
            ]
          },
          "from_mode": {
            "const": "air"
          },
          "to_mode": {
            "type": "string",
            "enum": [
              "ocean",
              "rail",
              "road"
            ]
          },
          "alternative": {
            "type": "string",
            "enum": [
              "existing_lane",
              "estimated"
            ],
            "description": "existing_lane: the pair already runs the other mode; estimated: the other mode is costed on the lane's distance"
          },
          "distance_km": {
            "type": "number"
          },
          "shipped_mass_kg": {
            "type": "number"
          },
          "kg_co2e_before": {
            "type": "number"
          },
          "kg_co2e_after": {
            "type": "number"
          },
          "kg_co2e_saved": {
            "type": "number",
            "description": "From the DEFRA 2026 freight factors of the two modes"
          },
          "transit_days_before": {
            "type": [
              "number",
              "null"
            ],
            "description": "The lane's observed transit time"
          },
          "transit_days_after": {
            "type": [
              "number",
              "null"
            ],
            "description": "The other lane's observed transit time; null when it is modelled"
          },
          "priority": {
            "type": "number",
            "description": "40-100, higher first"
          },
          "reason": {
            "type": "string"
          },
          "formula": {
            "type": "string"
          },
          "recommendation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The task waiting in approvals; null while the candidate has not been sent"
          }
        },
        "required": [
          "key",
          "supplier",
          "location",
          "from_mode",
          "to_mode",
          "alternative",
          "distance_km",
          "shipped_mass_kg",
          "kg_co2e_before",
          "kg_co2e_after",
          "kg_co2e_saved",
          "transit_days_before",
          "transit_days_after",
          "priority",
          "reason",
          "formula",
          "recommendation_id"
        ]
      },
      "NewProductForecast": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": "string",
            "description": "Upper case; UNCATEGORIZED when the item has none"
          },
          "own_history_days": {
            "type": "integer",
            "description": "Days with demand of its own in the window (under 14)"
          },
          "method": {
            "const": "like_item_category_mean"
          },
          "estimatedDailyRate": {
            "type": "number"
          },
          "horizonTotal": {
            "type": "number",
            "description": "Estimated units over the horizon"
          },
          "basisCount": {
            "type": "integer",
            "description": "Same-category items the estimate rests on"
          },
          "basisItems": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Their external ids, at most 10"
          },
          "confidence": {
            "type": "string",
            "enum": [
              "low",
              "medium"
            ]
          }
        },
        "required": [
          "item",
          "description",
          "category",
          "own_history_days",
          "method",
          "estimatedDailyRate",
          "horizonTotal",
          "basisCount",
          "basisItems",
          "confidence"
        ]
      },
      "OwnRecall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "recall",
              "withdrawal"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed"
            ],
            "description": "open: the items of its lots do not move (the compliance gate) until it is closed"
          },
          "reason": {
            "type": "string"
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference"
          },
          "lot_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The lots named"
          },
          "item_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The items of those lots"
          },
          "include_descendants": {
            "type": "boolean",
            "description": "Lots made from the named lots are held too"
          },
          "opened_by": {
            "type": "string",
            "format": "uuid"
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "closed_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "closed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "close_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "follow_up": {
            "type": "object",
            "properties": {
              "holds_proposed": {
                "type": "integer"
              },
              "lots": {
                "type": "integer"
              },
              "descendant_lots": {
                "type": "integer"
              },
              "customers": {
                "type": "integer"
              },
              "locations_with_stock": {
                "type": "integer"
              }
            },
            "description": "What opening it proposed (counts)"
          },
          "follow_up_done_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "reason",
          "reference",
          "lot_ids",
          "item_ids",
          "include_descendants",
          "opened_by",
          "opened_at",
          "closed_by",
          "closed_at",
          "close_note",
          "follow_up",
          "follow_up_done_at",
          "created_at",
          "updated_at"
        ]
      },
      "ParcelAssessment": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "The parcel's position in the request, from 0"
          },
          "id": {
            "type": "string",
            "description": "The id you sent"
          },
          "status": {
            "const": "assessed"
          },
          "destination_country": {
            "type": "string",
            "enum": [
              "AE",
              "SA",
              "EG"
            ]
          },
          "origin_country": {
            "type": "string"
          },
          "hs_code": {
            "type": "string",
            "description": "The code you sent, digits only"
          },
          "resolved_code": {
            "type": "string",
            "description": "The tariff line the answer is for: 12 digits for the UAE, the shared 8 digits for Saudi Arabia (12 once its own schedule is loaded), 10 digits for Egypt"
          },
          "description": {
            "type": "string",
            "description": "The tariff's words for the line"
          },
          "entry": {
            "type": "object",
            "properties": {
              "channel": {
                "type": "string",
                "enum": [
                  "courier",
                  "post",
                  "ecommerce_parcel"
                ]
              },
              "personal_import": {
                "type": "boolean"
              }
            },
            "required": [
              "channel",
              "personal_import"
            ],
            "description": "How the parcel enters, as read from the request"
          },
          "currency": {
            "type": "string",
            "enum": [
              "AED",
              "SAR",
              "EGP"
            ],
            "description": "The currency of every amount in the answer"
          },
          "exchange_rate": {
            "type": "object",
            "properties": {
              "base": {
                "const": "USD"
              },
              "quote": {
                "type": "string",
                "enum": [
                  "AED",
                  "SAR",
                  "EGP"
                ]
              },
              "rate": {
                "type": "number"
              },
              "note": {
                "type": "string"
              },
              "source_url": {
                "type": "string"
              }
            },
            "required": [
              "base",
              "quote",
              "rate",
              "note",
              "source_url"
            ]
          },
          "goods_value": {
            "type": "number"
          },
          "freight_cost": {
            "type": "number"
          },
          "insurance_cost": {
            "type": "number"
          },
          "customs_value": {
            "type": "number",
            "description": "Goods, freight and insurance: what duty and the value limit are measured on"
          },
          "duty": {
            "type": "object",
            "properties": {
              "rate_percent": {
                "type": "number",
                "description": "The rate charged: the preferential rate when `preference` is present, otherwise the base rate"
              },
              "base_rate_percent": {
                "type": "number",
                "description": "The line's normal rate"
              },
              "rate_status": {
                "type": "string",
                "enum": [
                  "official",
                  "unverified",
                  "confirmed_by_you"
                ],
                "description": "confirmed_by_you: the rate your organisation saved as confirmed for the code. unverified (a Saudi parcel without one): the rate is the common tariff's for the code, not Saudi Arabia's own, which may be higher; confirm it before relying on it"
              },
              "rate_warning": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rate_note": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "With confirmed_by_you: whose rate it is, and the common tariff's rate beside it"
              },
              "preference": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "program": {
                    "type": "string"
                  },
                  "rate_percent": {
                    "type": "number"
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": [
                  "program",
                  "rate_percent",
                  "note"
                ],
                "description": "A lower rate the origin has under an agreement. It holds only with proof of origin"
              },
              "amount": {
                "type": "number",
                "description": "Duty in the total. 0 when the exemption was applied"
              },
              "exemption": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "rule": {
                    "type": "string",
                    "enum": [
                      "ae_ecommerce_parcel",
                      "sa_personal_online_purchase"
                    ],
                    "description": "The low-value rule of the destination"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "applied",
                      "conditional",
                      "not_applied"
                    ],
                    "description": "applied: no duty was charged. conditional: the parcel is within the limit, but a rule on file applies or may apply to its code and goods that need a permit lose the exemption, so the duty IS in the total and `if_exempt` gives the figures without it. not_applied: see `reason`"
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "within_limit",
                      "needs_permit_check",
                      "not_claimed",
                      "over_limit",
                      "excise_goods"
                    ],
                    "description": "not_claimed: the request did not say the parcel enters through the e-commerce channel (AE) or is a personal purchase (SA)"
                  },
                  "limit": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number"
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "AED",
                          "SAR"
                        ]
                      },
                      "comparison": {
                        "type": "string",
                        "enum": [
                          "at_or_under",
                          "under"
                        ],
                        "description": "Whether a customs value equal to the amount is still exempt"
                      }
                    },
                    "required": [
                      "amount",
                      "currency",
                      "comparison"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "description": "One or two sentences saying what happened and why"
                  },
                  "source": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "url"
                    ],
                    "description": "The official text of the rule"
                  },
                  "conditional_on": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "conditional: the `rule_ref` of each rule it depends on (compliance.conditions)"
                  },
                  "if_exempt": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "duty_amount": {
                        "type": "number"
                      },
                      "vat_amount": {
                        "type": "number"
                      },
                      "total": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "duty_amount",
                      "vat_amount",
                      "total"
                    ],
                    "description": "conditional: the figures if the exemption holds"
                  }
                },
                "required": [
                  "rule",
                  "status",
                  "reason",
                  "limit",
                  "note",
                  "source",
                  "conditional_on",
                  "if_exempt"
                ]
              },
              "code_match": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "exact",
                  "ambiguous",
                  "ancestor",
                  null
                ],
                "description": "exact: the code is a line. ambiguous: it covers lines with different rates and the first was used. ancestor: it is not a line, and the lines above it were used"
              },
              "source": {
                "type": "object",
                "properties": {
                  "authority": {
                    "type": "string",
                    "enum": [
                      "us_official_schedule",
                      "uk_official_schedule",
                      "eu_official_schedule",
                      "ca_official_schedule",
                      "ae_official_schedule",
                      "gcc_common_tariff",
                      "sa_official_schedule",
                      "eg_official_schedule"
                    ],
                    "description": "Whose schedule the rate was read from"
                  },
                  "as_of": {
                    "type": "string",
                    "format": "date"
                  }
                },
                "required": [
                  "authority",
                  "as_of"
                ]
              }
            },
            "required": [
              "rate_percent",
              "base_rate_percent",
              "rate_status",
              "rate_warning",
              "rate_note",
              "preference",
              "amount",
              "exemption",
              "code_match",
              "source"
            ]
          },
          "excise": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "computed",
                  "not_applicable",
                  "not_computed"
                ],
                "description": "not_computed: the code is one of excise goods and the request did not carry what excise is charged on, so excise is NOT in the total"
              },
              "amount": {
                "type": "number"
              },
              "basis": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "status",
              "amount",
              "basis",
              "source",
              "source_url"
            ]
          },
          "other_taxes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tax": {
                  "type": "string",
                  "enum": [
                    "vat",
                    "table_tax",
                    "other"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "name_local": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "computed",
                    "not_computed"
                  ],
                  "description": "not_computed: stated per unit or as a minimum and no quantity was sent (measures), or a percentage with no base; not in the total"
                },
                "rate": {
                  "type": "string"
                },
                "rate_percent": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "basis": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "taxable_base": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "amount": {
                  "type": "number"
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "tax",
                "name",
                "name_local",
                "status",
                "rate",
                "rate_percent",
                "basis",
                "taxable_base",
                "amount",
                "note"
              ]
            },
            "description": "EG only: the other taxes the tariff line states beside VAT"
          },
          "not_included": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "EG only: what the total leaves out, one sentence each"
          },
          "fee": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "amount": {
                "type": "number"
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "amount",
              "note"
            ],
            "description": "The customs declaration fee (UAE, Saudi Arabia); for Egypt, the fees the tariff line's instructions set"
          },
          "vat": {
            "type": "object",
            "properties": {
              "rate_percent": {
                "type": "number"
              },
              "taxable_base": {
                "type": "number"
              },
              "amount": {
                "type": "number"
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "rate_percent",
              "taxable_base",
              "amount",
              "note"
            ],
            "description": "Import VAT. Charged whatever the value: neither country has a low-value VAT exemption"
          },
          "total": {
            "type": "number",
            "description": "Customs value, duty, excise, the fee and VAT"
          },
          "compliance": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "prohibited",
                  "conditional",
                  "possible_conditions",
                  "none_on_file"
                ],
                "description": "prohibited: a rule on file bars the goods. conditional: at least one rule applies and names what the goods need. possible_conditions: a rule may apply. none_on_file: no rule on file matches the code, which is not a clearance"
              },
              "conditions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "match": {
                      "type": "string",
                      "enum": [
                        "applies",
                        "possible"
                      ],
                      "description": "applies: the rule covers the code. possible: it covers only some lines under the code, or a fact about the goods that was not sent decides; the full 12-digit code usually settles it"
                    },
                    "rule_ref": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "An opaque reference to the rule, the same for the same rule"
                    },
                    "rule_type": {
                      "type": "string",
                      "enum": [
                        "prohibition",
                        "licence",
                        "conformity",
                        "technical_fit"
                      ]
                    },
                    "effect": {
                      "type": "string",
                      "enum": [
                        "prohibited",
                        "certificate_or_permit"
                      ],
                      "description": "prohibited: the goods may not enter. certificate_or_permit: they need what `requirement` names"
                    },
                    "requirement": {
                      "type": "string",
                      "description": "What the rule requires"
                    },
                    "satisfied_by": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true,
                      "description": "What satisfies the rule, as the rule states it (document kinds, standards)"
                    },
                    "authority": {
                      "type": "string",
                      "description": "The authority behind the rule"
                    },
                    "source_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "match",
                    "rule_ref",
                    "rule_type",
                    "effect",
                    "requirement",
                    "satisfied_by",
                    "authority",
                    "source_url"
                  ]
                }
              },
              "upcoming": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "match": {
                      "type": "string",
                      "enum": [
                        "applies",
                        "possible"
                      ],
                      "description": "applies: the rule covers the code. possible: it covers only some lines under the code, or a fact about the goods that was not sent decides; the full 12-digit code usually settles it"
                    },
                    "rule_ref": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "An opaque reference to the rule, the same for the same rule"
                    },
                    "rule_type": {
                      "type": "string",
                      "enum": [
                        "prohibition",
                        "licence",
                        "conformity",
                        "technical_fit"
                      ]
                    },
                    "effect": {
                      "type": "string",
                      "enum": [
                        "prohibited",
                        "certificate_or_permit"
                      ],
                      "description": "prohibited: the goods may not enter. certificate_or_permit: they need what `requirement` names"
                    },
                    "requirement": {
                      "type": "string",
                      "description": "What the rule requires"
                    },
                    "satisfied_by": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true,
                      "description": "What satisfies the rule, as the rule states it (document kinds, standards)"
                    },
                    "authority": {
                      "type": "string",
                      "description": "The authority behind the rule"
                    },
                    "source_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "effective_from": {
                      "type": "string",
                      "format": "date"
                    }
                  },
                  "required": [
                    "match",
                    "rule_ref",
                    "rule_type",
                    "effect",
                    "requirement",
                    "satisfied_by",
                    "authority",
                    "source_url",
                    "effective_from"
                  ]
                },
                "description": "Rules that will apply from a later date"
              },
              "note": {
                "type": "string",
                "description": "What is and is not on file for the destination"
              }
            },
            "required": [
              "status",
              "conditions",
              "upcoming",
              "note"
            ],
            "description": "The import conditions on file for the tariff code in the destination"
          },
          "screening": {
            "type": "object",
            "properties": {
              "seller": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "clear",
                      "possible_match",
                      "not_screened"
                    ],
                    "description": "clear: no list entry resembles the name closely enough to review. possible_match: at least one does; a person has to look. not_screened: see `reason`"
                  },
                  "strength": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "strong",
                      "possible",
                      null
                    ],
                    "description": "possible_match only. strong: a near-exact name"
                  },
                  "best_score": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "0 to 1: the closest entry's score; null when nothing came close"
                  },
                  "matches": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "The list entry's name"
                        },
                        "list": {
                          "type": "string",
                          "description": "The list it is on"
                        },
                        "programs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "entity_type": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "score": {
                          "type": "number",
                          "description": "0 to 1: name similarity, raised when the country is the same"
                        },
                        "name_score": {
                          "type": "number",
                          "description": "0 to 1: name similarity alone"
                        },
                        "country_match": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "name",
                        "list",
                        "programs",
                        "country",
                        "entity_type",
                        "score",
                        "name_score",
                        "country_match"
                      ]
                    },
                    "description": "possible_match: the closest list entries, at most 5"
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "not_screened: why"
                  }
                },
                "required": [
                  "status",
                  "strength",
                  "best_score",
                  "matches",
                  "reason"
                ],
                "description": "A name compared with the denied-party lists. A comparison of names, not a finding about a person; nothing about the party is stored"
              },
              "buyer": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "clear",
                      "possible_match",
                      "not_screened"
                    ],
                    "description": "clear: no list entry resembles the name closely enough to review. possible_match: at least one does; a person has to look. not_screened: see `reason`"
                  },
                  "strength": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "strong",
                      "possible",
                      null
                    ],
                    "description": "possible_match only. strong: a near-exact name"
                  },
                  "best_score": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "0 to 1: the closest entry's score; null when nothing came close"
                  },
                  "matches": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "The list entry's name"
                        },
                        "list": {
                          "type": "string",
                          "description": "The list it is on"
                        },
                        "programs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "entity_type": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "score": {
                          "type": "number",
                          "description": "0 to 1: name similarity, raised when the country is the same"
                        },
                        "name_score": {
                          "type": "number",
                          "description": "0 to 1: name similarity alone"
                        },
                        "country_match": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "name",
                        "list",
                        "programs",
                        "country",
                        "entity_type",
                        "score",
                        "name_score",
                        "country_match"
                      ]
                    },
                    "description": "possible_match: the closest list entries, at most 5"
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "not_screened: why"
                  }
                },
                "required": [
                  "status",
                  "strength",
                  "best_score",
                  "matches",
                  "reason"
                ],
                "description": "A name compared with the denied-party lists. A comparison of names, not a finding about a person; nothing about the party is stored"
              }
            },
            "required": [
              "seller",
              "buyer"
            ],
            "description": "null for a party the parcel did not name"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "index",
          "id",
          "status",
          "destination_country",
          "origin_country",
          "hs_code",
          "resolved_code",
          "description",
          "entry",
          "currency",
          "exchange_rate",
          "goods_value",
          "freight_cost",
          "insurance_cost",
          "customs_value",
          "duty",
          "excise",
          "fee",
          "vat",
          "total",
          "compliance",
          "screening",
          "notes"
        ]
      },
      "ParcelError": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The id you sent; null when the parcel carried none"
          },
          "status": {
            "const": "error"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_parcel",
                  "hs_code_not_found",
                  "rate_unreadable",
                  "tariff_unavailable"
                ],
                "description": "invalid_parcel: a field is missing or wrong. hs_code_not_found: the tariff has no line under the code. tariff_unavailable: the tariff could not be read; send the parcel again later"
              },
              "field": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The field to correct"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "field",
              "message"
            ]
          }
        },
        "required": [
          "index",
          "id",
          "status",
          "error"
        ]
      },
      "Passport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string",
            "description": "Your id for the passport"
          },
          "granularity": {
            "type": "string",
            "enum": [
              "model",
              "batch",
              "item"
            ],
            "description": "What one passport covers: a product model, a production batch, or a single item"
          },
          "title": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Text by language tag (en, fr, ...)"
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "gtin": {
            "type": [
              "string",
              "null"
            ],
            "description": "GTIN, 8 to 14 digits"
          },
          "batch_lot": {
            "type": [
              "string",
              "null"
            ]
          },
          "serial": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published",
              "archived"
            ]
          },
          "compliance_state": {
            "type": "string",
            "enum": [
              "incomplete",
              "ready",
              "registered",
              "failing"
            ],
            "description": "incomplete: requirements are open; ready: nothing blocking or required is open; registered: not set any more (the only registry is simulated); failing: published with a blocking requirement open"
          },
          "completeness_score": {
            "type": "number",
            "description": "How complete the passport is, 0 to 100"
          },
          "public_enabled": {
            "type": "boolean",
            "description": "Whether the published passport answers anonymous scans"
          },
          "profile": {
            "type": "string",
            "enum": [
              "textile",
              "leather_goods",
              "food_coffee",
              "food_general",
              "appliance",
              "general"
            ],
            "description": "The product profile the passport is scored against"
          },
          "model_passport_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "A batch or item passport's model passport, which it inherits from"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "item_id": {
            "type": "string",
            "format": "uuid",
            "description": "The item the passport is for"
          },
          "variant_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "lot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "tracked_unit_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "item_external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "lot_external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "published_version_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The version of record; null until the passport is published"
          },
          "draft_data": {
            "type": "object",
            "additionalProperties": true,
            "description": "The editorial fields of the passport's profile, validated and merged key by key: economic_operator, manufacturing, stage_origins, care_instructions, durability, repairability, circularity, impact, svhc_declaration_made, image_urls, certifications, food, appliance; erp_fill on a batch filled from its lot"
          },
          "ruleset_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "The version of the requirement set the score was taken against"
          },
          "registry_ref": {
            "type": [
              "string",
              "null"
            ],
            "description": "Unused: the only registry is simulated and no longer writes here"
          },
          "eu_market": {
            "type": "boolean",
            "description": "Whether the product is placed on the EU market (an EUDR-scope product then needs a DDS reference)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "external_id",
          "granularity",
          "title",
          "brand",
          "category",
          "gtin",
          "batch_lot",
          "serial",
          "status",
          "compliance_state",
          "completeness_score",
          "public_enabled",
          "profile",
          "model_passport_id",
          "updated_at",
          "org_id",
          "item_id",
          "variant_id",
          "lot_id",
          "tracked_unit_id",
          "item_external_id",
          "lot_external_id",
          "published_version_id",
          "draft_data",
          "ruleset_version",
          "registry_ref",
          "eu_market",
          "created_at"
        ]
      },
      "PassportCompleteness": {
        "type": "object",
        "properties": {
          "score": {
            "type": "number",
            "description": "How complete the passport is, 0 to 100, over the requirements that apply to it"
          },
          "sections": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "section": {
                  "type": "string",
                  "enum": [
                    "identity",
                    "materials",
                    "substances",
                    "circularity",
                    "impact",
                    "supply_chain",
                    "compliance",
                    "lifecycle"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "score": {
                  "type": "number",
                  "description": "0 to 100 within the section"
                },
                "met": {
                  "type": "integer"
                },
                "total": {
                  "type": "integer",
                  "description": "Requirements of the section that apply to this passport"
                },
                "weight": {
                  "type": "number"
                }
              },
              "required": [
                "section",
                "label",
                "score",
                "met",
                "total",
                "weight"
              ]
            }
          },
          "gaps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The requirement, for example identity.gtin"
                },
                "label": {
                  "type": "string"
                },
                "section": {
                  "type": "string",
                  "enum": [
                    "identity",
                    "materials",
                    "substances",
                    "circularity",
                    "impact",
                    "supply_chain",
                    "compliance",
                    "lifecycle"
                  ]
                },
                "sectionLabel": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "blocking",
                    "required",
                    "recommended"
                  ],
                  "description": "blocking: the passport cannot be published without it; required: expected; recommended: good practice"
                },
                "weight": {
                  "type": "number",
                  "description": "The requirement's share of the 0 to 100 score"
                },
                "remediation": {
                  "type": "string",
                  "description": "What to do to meet it"
                },
                "regulationRefs": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id",
                "label",
                "section",
                "sectionLabel",
                "severity",
                "weight",
                "remediation",
                "regulationRefs"
              ]
            },
            "description": "The requirements not met, most severe first"
          },
          "blockingGaps": {
            "type": "integer"
          },
          "requiredGaps": {
            "type": "integer"
          },
          "applicable": {
            "type": "integer",
            "description": "Requirements that apply to this passport"
          },
          "met": {
            "type": "integer"
          },
          "rulesetVersion": {
            "type": "string"
          },
          "profile": {
            "type": "string",
            "enum": [
              "textile",
              "leather_goods",
              "food_coffee",
              "food_general",
              "appliance",
              "general"
            ],
            "description": "The product profile the passport is scored against"
          },
          "regulatoryStatus": {
            "type": "string",
            "enum": [
              "espr_preparation",
              "voluntary",
              "guidance",
              "minimal"
            ],
            "description": "espr_preparation: textile and leather (the ESPR textile act is not final); voluntary: food, which ESPR excludes; guidance: appliances; minimal: general"
          }
        },
        "required": [
          "score",
          "sections",
          "gaps",
          "blockingGaps",
          "requiredGaps",
          "applicable",
          "met",
          "rulesetVersion",
          "profile",
          "regulatoryStatus"
        ]
      },
      "PassportCustodyCoverage": {
        "type": "object",
        "properties": {
          "covered": {
            "type": "integer",
            "description": "Transfers with at least one document behind them"
          },
          "total": {
            "type": "integer"
          },
          "gaps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ]
            }
          },
          "perTransfer": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "externalId": {
                  "type": "string"
                },
                "evidenceCount": {
                  "type": "integer"
                },
                "covered": {
                  "type": "boolean"
                }
              },
              "required": [
                "externalId",
                "evidenceCount",
                "covered"
              ]
            }
          },
          "originAnchored": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the earliest transfer leaves from a country a material declares as its origin; null when there are no transfers or no declared origin"
          }
        },
        "required": [
          "covered",
          "total",
          "gaps",
          "perTransfer",
          "originAnchored"
        ]
      },
      "PassportCustodyTransfer": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string"
          },
          "fromParty": {
            "type": "string"
          },
          "toParty": {
            "type": "string"
          },
          "fromCountry": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "fromRegion": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the goods left from, set only from confirmed origin evidence"
          },
          "transferDate": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "materialExternalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplierExternalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ]
          },
          "uom": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "documentExternalId": {
                  "type": "string"
                },
                "evidenceKind": {
                  "type": "string",
                  "enum": [
                    "purchase_order",
                    "invoice",
                    "bill_of_lading",
                    "packing_list",
                    "certificate",
                    "other"
                  ]
                }
              },
              "required": [
                "documentExternalId",
                "evidenceKind"
              ]
            },
            "description": "The passport's documents behind the transfer"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "externalId",
          "fromParty",
          "toParty",
          "fromCountry",
          "fromRegion",
          "transferDate",
          "description",
          "materialExternalId",
          "supplierExternalId",
          "quantity",
          "uom",
          "evidence",
          "updatedAt"
        ]
      },
      "PassportCustodyTransferWritten": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string"
          },
          "fromParty": {
            "type": "string"
          },
          "toParty": {
            "type": "string"
          },
          "fromCountry": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "fromRegion": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the goods left from, set only from confirmed origin evidence"
          },
          "transferDate": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "materialExternalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplierExternalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ]
          },
          "uom": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "documentExternalId": {
                  "type": "string"
                },
                "evidenceKind": {
                  "type": "string",
                  "enum": [
                    "purchase_order",
                    "invoice",
                    "bill_of_lading",
                    "packing_list",
                    "certificate",
                    "other"
                  ]
                }
              },
              "required": [
                "documentExternalId",
                "evidenceKind"
              ]
            },
            "description": "The passport's documents behind the transfer"
          }
        },
        "required": [
          "externalId",
          "fromParty",
          "toParty",
          "fromCountry",
          "fromRegion",
          "transferDate",
          "description",
          "materialExternalId",
          "supplierExternalId",
          "quantity",
          "uom",
          "evidence"
        ]
      },
      "PassportDdsReference": {
        "type": "object",
        "properties": {
          "reference_number": {
            "type": "string"
          },
          "verification_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "recorded_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "reference_number",
          "verification_number",
          "note",
          "recorded_by",
          "created_at"
        ]
      },
      "PassportDocument": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "certificate",
              "test_report",
              "declaration_of_conformity",
              "care_label",
              "image",
              "repair_manual",
              "disassembly_guide",
              "other"
            ]
          },
          "title": {
            "type": "string"
          },
          "issuer": {
            "type": [
              "string",
              "null"
            ]
          },
          "standard_ref": {
            "type": [
              "string",
              "null"
            ],
            "description": "The standard or scheme the document is issued under"
          },
          "valid_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "min_audience": {
            "type": "string",
            "enum": [
              "consumer",
              "recycler",
              "authority",
              "internal"
            ],
            "description": "The least-privileged audience that may see it"
          },
          "size_bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "A link to the file, valid for 15 minutes; null when the file cannot be linked (not uploaded yet)"
          }
        },
        "required": [
          "id",
          "external_id",
          "kind",
          "title",
          "issuer",
          "standard_ref",
          "valid_from",
          "valid_until",
          "min_audience",
          "size_bytes",
          "content_type",
          "url"
        ]
      },
      "PassportEstimatedValue": {
        "type": "object",
        "properties": {
          "value": {
            "type": "number"
          },
          "unit": {
            "type": "string",
            "description": "kg CO2e"
          },
          "method": {
            "type": "string",
            "description": "The figure's working, in words"
          },
          "dataset": {
            "type": "string"
          },
          "datasetVersion": {
            "type": "string"
          },
          "factorId": {
            "type": "string",
            "description": "The factor applied, or aggregate for a sum"
          },
          "basis": {
            "const": "industry_estimate",
            "description": "Always an industry estimate, never a measurement"
          },
          "caution": {
            "type": "string",
            "description": "What the estimate leaves out or assumes"
          }
        },
        "required": [
          "value",
          "unit",
          "method",
          "dataset",
          "datasetVersion",
          "factorId",
          "basis",
          "caution"
        ]
      },
      "PassportEudrLotPlot": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string"
          },
          "materialExternalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The material the plot is for; null when it covers every in-scope material"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "geometry": {
            "$ref": "#/components/schemas/PassportPlotGeometry"
          },
          "areaHa": {
            "type": [
              "number",
              "null"
            ],
            "description": "Hectares"
          },
          "producerCountry": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "commodity": {
            "type": "string",
            "enum": [
              "cattle",
              "leather",
              "wood",
              "rubber",
              "coffee",
              "cocoa",
              "palm_oil",
              "soy"
            ]
          },
          "producerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "producerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "deforestationFreeDeclaredBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who declared the plot was not deforested after 2020-12-31: recorded, not checked"
          },
          "deforestationFreeDeclaredOn": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "lotExternalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The lot the plot is attached to"
          }
        },
        "required": [
          "externalId",
          "materialExternalId",
          "description",
          "geometry",
          "areaHa",
          "producerCountry",
          "commodity",
          "producerName",
          "producerId",
          "deforestationFreeDeclaredBy",
          "deforestationFreeDeclaredOn",
          "lotExternalId"
        ]
      },
      "PassportEudrPlot": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string"
          },
          "materialExternalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The material the plot is for; null when it covers every in-scope material"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "geometry": {
            "$ref": "#/components/schemas/PassportPlotGeometry"
          },
          "areaHa": {
            "type": [
              "number",
              "null"
            ],
            "description": "Hectares"
          },
          "producerCountry": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "commodity": {
            "type": "string",
            "enum": [
              "cattle",
              "leather",
              "wood",
              "rubber",
              "coffee",
              "cocoa",
              "palm_oil",
              "soy"
            ]
          },
          "producerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "producerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "deforestationFreeDeclaredBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who declared the plot was not deforested after 2020-12-31: recorded, not checked"
          },
          "deforestationFreeDeclaredOn": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "submittedBySupplier": {
            "type": "boolean",
            "description": "Whether a supplier sent the plot through a supplier link"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "externalId",
          "materialExternalId",
          "description",
          "geometry",
          "areaHa",
          "producerCountry",
          "commodity",
          "producerName",
          "producerId",
          "deforestationFreeDeclaredBy",
          "deforestationFreeDeclaredOn",
          "submittedBySupplier",
          "updatedAt"
        ]
      },
      "PassportEudrPlotWritten": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string"
          },
          "materialExternalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The material the plot is for; null when it covers every in-scope material"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "geometry": {
            "$ref": "#/components/schemas/PassportPlotGeometry"
          },
          "areaHa": {
            "type": [
              "number",
              "null"
            ],
            "description": "Hectares"
          },
          "producerCountry": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "commodity": {
            "type": "string",
            "enum": [
              "cattle",
              "leather",
              "wood",
              "rubber",
              "coffee",
              "cocoa",
              "palm_oil",
              "soy"
            ]
          },
          "producerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "producerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "deforestationFreeDeclaredBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who declared the plot was not deforested after 2020-12-31: recorded, not checked"
          },
          "deforestationFreeDeclaredOn": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          }
        },
        "required": [
          "externalId",
          "materialExternalId",
          "description",
          "geometry",
          "areaHa",
          "producerCountry",
          "commodity",
          "producerName",
          "producerId",
          "deforestationFreeDeclaredBy",
          "deforestationFreeDeclaredOn"
        ]
      },
      "PassportEudrReadiness": {
        "type": "object",
        "properties": {
          "inScope": {
            "type": "boolean",
            "description": "Whether a composition row is an Annex I commodity (coffee, cocoa, palm oil, soy, wood, cattle or leather) or a plot of one is attached"
          },
          "ready": {
            "type": "boolean",
            "description": "In scope, every in-scope row covered by a valid plot, and a DDS reference recorded when placed on the EU market"
          },
          "commodities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "cattle",
                "leather",
                "wood",
                "rubber",
                "coffee",
                "cocoa",
                "palm_oil",
                "soy"
              ]
            }
          },
          "gaps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ]
            }
          },
          "plotCount": {
            "type": "integer"
          },
          "lotPlotCount": {
            "type": "integer",
            "description": "Plots that come from the passport's lot or the green lots it was made from"
          },
          "coveredMaterials": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "External ids of the in-scope materials with a valid plot"
          },
          "uncoveredMaterials": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "euMarket": {
            "type": "boolean"
          },
          "ddsReferenceCount": {
            "type": "integer"
          },
          "plotsWithoutAttestation": {
            "type": "integer",
            "description": "Plots with no recorded cut-off attestation (informational)"
          }
        },
        "required": [
          "inScope",
          "ready",
          "commodities",
          "gaps",
          "plotCount",
          "lotPlotCount",
          "coveredMaterials",
          "uncoveredMaterials",
          "euMarket",
          "ddsReferenceCount",
          "plotsWithoutAttestation"
        ]
      },
      "PassportEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string",
            "enum": [
              "manufactured",
              "quality_checked",
              "shipped",
              "received",
              "sold",
              "repaired",
              "refurbished",
              "resold",
              "returned",
              "recycled",
              "disposed",
              "recalled",
              "inspected"
            ]
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "actor_kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "For example manufacturer, brand, retailer, repairer"
          },
          "actor_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "min_audience": {
            "type": "string",
            "enum": [
              "consumer",
              "recycler",
              "authority",
              "internal"
            ],
            "description": "The least-privileged audience that may see it"
          },
          "details": {
            "type": "object",
            "additionalProperties": true,
            "description": "The details you sent with the event"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "api",
              "csv",
              "connector",
              "sensor",
              "sample"
            ],
            "description": "How the event arrived"
          }
        },
        "required": [
          "id",
          "external_id",
          "event_type",
          "occurred_at",
          "actor_kind",
          "actor_name",
          "country_code",
          "min_audience",
          "details",
          "source"
        ]
      },
      "PassportGapTotal": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The requirement, for example identity.gtin"
          },
          "label": {
            "type": "string"
          },
          "section": {
            "type": "string",
            "enum": [
              "identity",
              "materials",
              "substances",
              "circularity",
              "impact",
              "supply_chain",
              "compliance",
              "lifecycle"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "blocking",
              "required",
              "recommended"
            ],
            "description": "blocking: the passport cannot be published without it; required: expected; recommended: good practice"
          },
          "count": {
            "type": "integer",
            "description": "Passports missing it"
          },
          "impact": {
            "type": "number",
            "description": "The score weight those passports lose to it, summed"
          }
        },
        "required": [
          "id",
          "label",
          "section",
          "severity",
          "count",
          "impact"
        ]
      },
      "PassportImpactEstimate": {
        "type": "object",
        "properties": {
          "basis": {
            "const": "industry_estimate",
            "description": "Always an industry estimate, never a measurement"
          },
          "dataset": {
            "type": "string"
          },
          "datasetVersion": {
            "type": "string"
          },
          "license": {
            "type": "string"
          },
          "attribution": {
            "type": "string"
          },
          "suppressedByMeasured": {
            "type": "boolean",
            "description": "True when the passport carries a measured carbon footprint: no estimate is given beside it"
          },
          "measuredCarbonKgCo2e": {
            "type": [
              "number",
              "null"
            ]
          },
          "transport": {
            "type": "object",
            "properties": {
              "legs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "externalId": {
                      "type": "string"
                    },
                    "label": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "estimate": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PassportEstimatedValue"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "na": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "externalId",
                    "label",
                    "estimate",
                    "na"
                  ]
                }
              },
              "totalKgCo2e": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PassportEstimatedValue"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "legs",
              "totalKgCo2e"
            ]
          },
          "energy": {
            "type": "object",
            "properties": {
              "estimate": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PassportEstimatedValue"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "na": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why there is no estimate; null when there is one"
              }
            },
            "required": [
              "estimate",
              "na"
            ]
          },
          "materials": {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "externalId": {
                      "type": "string"
                    },
                    "materialName": {
                      "type": "string"
                    },
                    "materialClass": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "estimate": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PassportEstimatedValue"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "na": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "externalId",
                    "materialName",
                    "materialClass",
                    "estimate",
                    "na"
                  ]
                }
              },
              "totalKgCo2e": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PassportEstimatedValue"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "rows",
              "totalKgCo2e"
            ]
          },
          "total": {
            "type": "object",
            "properties": {
              "estimate": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PassportEstimatedValue"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "na": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why there is no estimate; null when there is one"
              }
            },
            "required": [
              "estimate",
              "na"
            ]
          },
          "hasEstimates": {
            "type": "boolean"
          }
        },
        "required": [
          "basis",
          "dataset",
          "datasetVersion",
          "license",
          "attribution",
          "suppressedByMeasured",
          "measuredCarbonKgCo2e",
          "transport",
          "energy",
          "materials",
          "total",
          "hasEstimates"
        ]
      },
      "PassportInternalView": {
        "type": "object",
        "properties": {
          "audience": {
            "const": "internal"
          },
          "granularity": {
            "type": "string",
            "enum": [
              "model",
              "batch",
              "item"
            ]
          },
          "profile": {
            "type": "string",
            "enum": [
              "textile",
              "leather_goods",
              "food_coffee",
              "food_general",
              "appliance",
              "general"
            ],
            "description": "The product profile the passport is scored against"
          },
          "packaging": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "componentName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "materialName": {
                  "type": "string"
                },
                "materialClass": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "disposalInstruction": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "componentName",
                "materialName",
                "materialClass",
                "disposalInstruction"
              ]
            }
          },
          "food": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "netQuantity": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "value": {
                    "type": "number"
                  },
                  "unit": {
                    "type": "string"
                  }
                },
                "required": [
                  "value",
                  "unit"
                ]
              },
              "harvestYear": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "process": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "productionDate": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date",
                "description": "Roast date (coffee) or production date"
              },
              "productionCountry": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISO 3166-1 alpha-2 country code"
              },
              "productionSiteName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "bestBefore": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "allergenStatement": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "containsAllergens": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "ingredientStatement": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "netQuantity",
              "harvestYear",
              "process",
              "productionDate",
              "productionCountry",
              "productionSiteName",
              "bestBefore",
              "allergenStatement",
              "containsAllergens",
              "ingredientStatement"
            ]
          },
          "appliance": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "modelIdentifier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "manufacturerName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "energyClass": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "energyLabelUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "takebackUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "takebackInstructions": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "producerRegistrationNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "importerName": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "modelIdentifier",
              "manufacturerName",
              "energyClass",
              "energyLabelUrl",
              "takebackUrl",
              "takebackInstructions",
              "producerRegistrationNumber",
              "importerName"
            ]
          },
          "certificationClaims": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scheme": {
                  "type": "string"
                },
                "validUntil": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "manual",
                    "erp_lot"
                  ]
                },
                "certificateNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "scheme",
                "validUntil",
                "source",
                "certificateNumber"
              ]
            }
          },
          "inheritance": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "modelExternalId": {
                "type": "string"
              },
              "inherited": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "overridden": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "modelExternalId",
              "inherited",
              "overridden"
            ]
          },
          "product": {
            "type": "object",
            "properties": {
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "brand": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "imageRefs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "title",
              "brand",
              "category",
              "imageRefs"
            ]
          },
          "identifiers": {
            "type": "object",
            "properties": {
              "gtin": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "batchLot": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "serial": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "gtin",
              "batchLot",
              "serial"
            ]
          },
          "origin": {
            "type": "object",
            "properties": {
              "assemblyCountry": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISO 3166-1 alpha-2 country code"
              },
              "stages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "stage": {
                      "type": "string"
                    },
                    "countryCode": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "ISO 3166-1 alpha-2 country code"
                    }
                  },
                  "required": [
                    "stage",
                    "countryCode"
                  ]
                }
              },
              "manufacturedOn": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "YYYY-MM-DD when it is the lot's date; otherwise as you sent it"
              }
            },
            "required": [
              "assemblyCountry",
              "stages",
              "manufacturedOn"
            ]
          },
          "materials": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "externalRef": {
                  "type": "string"
                },
                "parentRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "componentName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "materialName": {
                  "type": "string"
                },
                "materialClass": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "massG": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "massSharePct": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "recycledContentPct": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "hazardous": {
                  "type": "boolean"
                },
                "originCountry": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "ISO 3166-1 alpha-2 country code"
                },
                "processingStage": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "provenance": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "brand_declared",
                    "supplier_attested",
                    "certificate",
                    null
                  ]
                },
                "certificateRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "componentKind": {
                  "type": "string",
                  "enum": [
                    "product",
                    "packaging"
                  ]
                },
                "disposalInstruction": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "originRegion": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "species": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "externalRef",
                "parentRef",
                "componentName",
                "materialName",
                "materialClass",
                "massG",
                "massSharePct",
                "recycledContentPct",
                "hazardous",
                "originCountry",
                "processingStage",
                "provenance",
                "certificateRef",
                "componentKind",
                "disposalInstruction"
              ],
              "description": "originRegion and species: food profiles only"
            }
          },
          "care": {
            "type": [
              "string",
              "null"
            ]
          },
          "durability": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "metric": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "standardRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "metric",
                "value",
                "standardRef"
              ]
            }
          },
          "repairability": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "score": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "summary": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sparePartsUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "disassemblySteps": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "disassemblyTools": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "score",
              "summary",
              "sparePartsUrl",
              "disassemblySteps",
              "disassemblyTools"
            ]
          },
          "circularity": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "recyclabilityRoute": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "takebackSchemeName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "takebackUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "materialRoutes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "material": {
                      "type": "string"
                    },
                    "route": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "material",
                    "route"
                  ]
                }
              },
              "eprRegistrationNumber": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "recyclabilityRoute",
              "takebackSchemeName",
              "takebackUrl",
              "materialRoutes",
              "eprRegistrationNumber"
            ]
          },
          "impact": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "carbonKgCo2e": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "method": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "boundary": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "methodologyNote": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "waterM3": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "energyKwh": {
                "type": [
                  "number",
                  "null"
                ]
              }
            },
            "required": [
              "carbonKgCo2e",
              "method",
              "boundary",
              "methodologyNote",
              "waterM3",
              "energyKwh"
            ]
          },
          "substances": {
            "type": "object",
            "properties": {
              "containsSvhc": {
                "type": "boolean"
              },
              "declarationMade": {
                "type": "boolean"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "substanceName": {
                      "type": "string"
                    },
                    "casNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "aboveThreshold": {
                      "type": "boolean"
                    },
                    "safeUseInstructions": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ecNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "regulation": {
                      "type": "string",
                      "enum": [
                        "REACH_SVHC",
                        "REACH_ANNEX_XVII",
                        "POP",
                        "CLP"
                      ]
                    },
                    "concentrationPpm": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "scipRef": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "substanceName",
                    "casNumber",
                    "aboveThreshold",
                    "safeUseInstructions",
                    "ecNumber",
                    "regulation",
                    "concentrationPpm",
                    "scipRef"
                  ]
                }
              }
            },
            "required": [
              "containsSvhc",
              "declarationMade",
              "items"
            ]
          },
          "certifications": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "standardRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "issuer": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "validUntil": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                }
              },
              "required": [
                "standardRef",
                "issuer",
                "validUntil"
              ]
            }
          },
          "lifecycle": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "eventType": {
                  "type": "string",
                  "enum": [
                    "manufactured",
                    "quality_checked",
                    "shipped",
                    "received",
                    "sold",
                    "repaired",
                    "refurbished",
                    "resold",
                    "returned",
                    "recycled",
                    "disposed",
                    "recalled",
                    "inspected"
                  ]
                },
                "on": {
                  "type": "string",
                  "format": "date-time"
                },
                "countryCode": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "ISO 3166-1 alpha-2 country code"
                },
                "actorKind": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "actorName": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "eventType",
                "on",
                "countryCode",
                "actorKind",
                "actorName"
              ]
            }
          },
          "compliance": {
            "type": "object",
            "properties": {
              "registryRef": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "completenessScore": {
                "type": "number"
              },
              "rulesetVersion": {
                "type": "string"
              },
              "sections": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "section": {
                      "type": "string",
                      "enum": [
                        "identity",
                        "materials",
                        "substances",
                        "circularity",
                        "impact",
                        "supply_chain",
                        "compliance",
                        "lifecycle"
                      ]
                    },
                    "label": {
                      "type": "string"
                    },
                    "score": {
                      "type": "number"
                    },
                    "met": {
                      "type": "integer"
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "section",
                    "label",
                    "score",
                    "met",
                    "total"
                  ]
                }
              },
              "gaps": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "severity": {
                      "type": "string",
                      "enum": [
                        "blocking",
                        "required",
                        "recommended"
                      ],
                      "description": "blocking: the passport cannot be published without it; required: expected; recommended: good practice"
                    }
                  },
                  "required": [
                    "id",
                    "label",
                    "severity"
                  ]
                }
              }
            },
            "required": [
              "registryRef",
              "completenessScore",
              "rulesetVersion",
              "sections",
              "gaps"
            ]
          },
          "version": {
            "type": "integer",
            "description": "0: this view is the working draft, not a published version"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the passport last changed"
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "documentRef": {
                  "type": "string",
                  "description": "The document's external id"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "certificate",
                    "test_report",
                    "declaration_of_conformity",
                    "care_label",
                    "image",
                    "repair_manual",
                    "disassembly_guide",
                    "other"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "issuer": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "standardRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "validUntil": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                }
              },
              "required": [
                "documentRef",
                "kind",
                "title",
                "issuer",
                "standardRef",
                "validUntil"
              ]
            }
          },
          "economicOperator": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "legalName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "eori": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "registeredAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "contactEmail": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "legalName",
              "eori",
              "registeredAddress",
              "contactEmail"
            ]
          },
          "manufacturing": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "facilityExternalId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "facilityCountry": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISO 3166-1 alpha-2 country code"
              }
            },
            "required": [
              "facilityExternalId",
              "facilityCountry"
            ]
          },
          "suppliers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "countryCode": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "ISO 3166-1 alpha-2 country code"
                },
                "role": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tier": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              },
              "required": [
                "name",
                "countryCode",
                "role",
                "tier"
              ]
            }
          }
        },
        "required": [
          "audience",
          "granularity",
          "profile",
          "packaging",
          "food",
          "appliance",
          "certificationClaims",
          "inheritance",
          "product",
          "identifiers",
          "origin",
          "materials",
          "care",
          "durability",
          "repairability",
          "circularity",
          "impact",
          "substances",
          "certifications",
          "lifecycle",
          "compliance",
          "version",
          "publishedAt",
          "documents",
          "economicOperator",
          "manufacturing",
          "suppliers"
        ],
        "description": "The passport as your own organization sees it: every field, from the working draft"
      },
      "PassportMaterial": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string"
          },
          "parentExternalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The material this one is a component of; null for a root material"
          },
          "sortOrder": {
            "type": "integer"
          },
          "componentName": {
            "type": [
              "string",
              "null"
            ]
          },
          "materialName": {
            "type": "string"
          },
          "materialClass": {
            "type": [
              "string",
              "null"
            ],
            "description": "For example natural_fibre, synthetic_fibre, leather, metal, plastic"
          },
          "massG": {
            "type": [
              "number",
              "null"
            ],
            "description": "Grams"
          },
          "massSharePct": {
            "type": [
              "number",
              "null"
            ],
            "description": "Share of the product's mass, 0 to 100"
          },
          "recycledContentPct": {
            "type": [
              "number",
              "null"
            ]
          },
          "renewableContentPct": {
            "type": [
              "number",
              "null"
            ]
          },
          "hazardous": {
            "type": "boolean"
          },
          "originCountry": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "processingStage": {
            "type": [
              "string",
              "null"
            ],
            "description": "fibre, spinning, weaving_knitting, dyeing_finishing or making_up"
          },
          "certificateDocumentExternalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The document on this passport that backs the declaration"
          },
          "componentKind": {
            "type": "string",
            "enum": [
              "product",
              "packaging"
            ],
            "description": "packaging rows are kept out of the composition's 100%"
          },
          "disposalInstruction": {
            "type": [
              "string",
              "null"
            ]
          },
          "originRegion": {
            "type": [
              "string",
              "null"
            ]
          },
          "producerGroup": {
            "type": [
              "string",
              "null"
            ]
          },
          "species": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "arabica",
              "robusta",
              null
            ]
          },
          "supplierRef": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "externalId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISO 3166-1 alpha-2 country code"
              },
              "role": {
                "type": "string",
                "description": "brand, manufacturer, tier1, tier2, recycler or repairer"
              },
              "tier": {
                "type": "number"
              }
            },
            "required": [
              "externalId",
              "name",
              "countryCode",
              "role",
              "tier"
            ]
          },
          "provenance": {
            "type": "string",
            "enum": [
              "brand_declared",
              "supplier_attested",
              "certificate"
            ],
            "description": "How the declaration is backed: by you, by the supplier's own statement, or by a valid certificate"
          }
        },
        "required": [
          "externalId",
          "parentExternalId",
          "sortOrder",
          "componentName",
          "materialName",
          "materialClass",
          "massG",
          "massSharePct",
          "recycledContentPct",
          "renewableContentPct",
          "hazardous",
          "originCountry",
          "processingStage",
          "certificateDocumentExternalId",
          "componentKind",
          "disposalInstruction",
          "originRegion",
          "producerGroup",
          "species",
          "supplierRef",
          "provenance"
        ]
      },
      "PassportMaterialWritten": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string"
          },
          "parentExternalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The material this one is a component of; null for a root material"
          },
          "sortOrder": {
            "type": "integer"
          },
          "componentName": {
            "type": [
              "string",
              "null"
            ]
          },
          "materialName": {
            "type": "string"
          },
          "materialClass": {
            "type": [
              "string",
              "null"
            ],
            "description": "For example natural_fibre, synthetic_fibre, leather, metal, plastic"
          },
          "massG": {
            "type": [
              "number",
              "null"
            ],
            "description": "Grams"
          },
          "massSharePct": {
            "type": [
              "number",
              "null"
            ],
            "description": "Share of the product's mass, 0 to 100"
          },
          "recycledContentPct": {
            "type": [
              "number",
              "null"
            ]
          },
          "renewableContentPct": {
            "type": [
              "number",
              "null"
            ]
          },
          "hazardous": {
            "type": "boolean"
          },
          "originCountry": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "processingStage": {
            "type": [
              "string",
              "null"
            ],
            "description": "fibre, spinning, weaving_knitting, dyeing_finishing or making_up"
          },
          "certificateDocumentExternalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The document on this passport that backs the declaration"
          },
          "componentKind": {
            "type": "string",
            "enum": [
              "product",
              "packaging"
            ],
            "description": "packaging rows are kept out of the composition's 100%"
          },
          "disposalInstruction": {
            "type": [
              "string",
              "null"
            ]
          },
          "originRegion": {
            "type": [
              "string",
              "null"
            ]
          },
          "producerGroup": {
            "type": [
              "string",
              "null"
            ]
          },
          "species": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "arabica",
              "robusta",
              null
            ]
          },
          "supplierRef": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "externalId": {
                "type": "string"
              },
              "name": {
                "type": "string",
                "description": "The supplier's external id again; the supplier's name is on GET materials"
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Always null in this answer"
              }
            },
            "required": [
              "externalId",
              "name",
              "countryCode"
            ]
          }
        },
        "required": [
          "externalId",
          "parentExternalId",
          "sortOrder",
          "componentName",
          "materialName",
          "materialClass",
          "massG",
          "massSharePct",
          "recycledContentPct",
          "renewableContentPct",
          "hazardous",
          "originCountry",
          "processingStage",
          "certificateDocumentExternalId",
          "componentKind",
          "disposalInstruction",
          "originRegion",
          "producerGroup",
          "species",
          "supplierRef"
        ]
      },
      "PassportOriginEvidence": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "document_external_id": {
            "type": "string"
          },
          "document_title": {
            "type": "string"
          },
          "document_kind": {
            "type": "string",
            "enum": [
              "certificate",
              "test_report",
              "declaration_of_conformity",
              "care_label",
              "image",
              "repair_manual",
              "disassembly_guide",
              "other"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "rejected"
            ],
            "description": "pending until a person confirms or rejects the reading"
          },
          "extraction": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "ok": {
                    "const": true
                  },
                  "extraction": {
                    "type": "object",
                    "properties": {
                      "documentType": {
                        "type": "string",
                        "enum": [
                          "transaction_certificate",
                          "bill_of_lading",
                          "gin_declaration",
                          "tannery_declaration",
                          "farm_declaration",
                          "plot_geolocation",
                          "other_traceability",
                          "not_traceability"
                        ]
                      },
                      "issuer": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "documentReference": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "origins": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "country": {
                              "type": "string",
                              "description": "ISO 3166-1 alpha-2 country code"
                            },
                            "regionCode": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "ISO 3166-2 subdivision code, for example IT-52"
                            },
                            "regionName": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "The region as the document prints it"
                            },
                            "material": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "page": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "description": "The page of the document it was read from"
                            }
                          },
                          "required": [
                            "country",
                            "regionCode",
                            "regionName",
                            "material",
                            "page"
                          ]
                        }
                      },
                      "plots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "ISO 3166-1 alpha-2 country code"
                            },
                            "geometry": {
                              "$ref": "#/components/schemas/PassportPlotGeometry"
                            },
                            "areaHa": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "page": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "description": "The page of the document it was read from"
                            }
                          },
                          "required": [
                            "label",
                            "country",
                            "geometry",
                            "areaHa",
                            "page"
                          ]
                        }
                      },
                      "custodySteps": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "seller": {
                              "type": "string"
                            },
                            "buyer": {
                              "type": "string"
                            },
                            "date": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "quantity": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "uom": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "documentReference": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "countryFrom": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "ISO 3166-1 alpha-2 country code"
                            },
                            "regionFrom": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "ISO 3166-2 subdivision code, for example IT-52"
                            },
                            "page": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "description": "The page of the document it was read from"
                            }
                          },
                          "required": [
                            "seller",
                            "buyer",
                            "date",
                            "quantity",
                            "uom",
                            "documentReference",
                            "countryFrom",
                            "regionFrom",
                            "page"
                          ]
                        }
                      },
                      "confidence": {
                        "type": "string",
                        "enum": [
                          "high",
                          "medium",
                          "low"
                        ]
                      },
                      "warnings": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Findings for the reviewer, for example custody_date_in_future"
                      }
                    },
                    "required": [
                      "documentType",
                      "issuer",
                      "documentReference",
                      "origins",
                      "plots",
                      "custodySteps",
                      "confidence",
                      "warnings"
                    ]
                  }
                },
                "required": [
                  "ok",
                  "extraction"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "ok": {
                    "const": false
                  },
                  "reason": {
                    "type": "string",
                    "description": "Why nothing usable was read, for example nothing_extracted or not_traceability_document"
                  }
                },
                "required": [
                  "ok",
                  "reason"
                ]
              }
            ],
            "description": "What was read from the document"
          },
          "extracted_at": {
            "type": "string",
            "format": "date-time"
          },
          "suggested": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "country": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISO 3166-1 alpha-2 country code"
              },
              "regionCode": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISO 3166-2 subdivision code, for example IT-52"
              },
              "regionName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ambiguous": {
                "type": "boolean",
                "description": "True when the document names more than one origin: the reviewer must choose"
              }
            },
            "required": [
              "country",
              "regionCode",
              "regionName",
              "ambiguous"
            ],
            "description": "The origin the review form opens with; null when nothing usable was read"
          },
          "confirmed_country": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 country code"
          },
          "confirmed_region_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-2 subdivision code, for example IT-52"
          },
          "confirmed_region_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "material_external_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The passport's materials the confirmed origin covers"
          },
          "review_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "reviewed_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who decided: an email, or api_key:<id>"
          },
          "reviewed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "document_external_id",
          "document_title",
          "document_kind",
          "status",
          "extraction",
          "extracted_at",
          "suggested",
          "confirmed_country",
          "confirmed_region_code",
          "confirmed_region_name",
          "material_external_ids",
          "review_note",
          "reviewed_by",
          "reviewed_at",
          "created_at"
        ]
      },
      "PassportPlotGeometry": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "Point"
              },
              "coordinates": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "description": "Longitude, latitude"
              }
            },
            "required": [
              "type",
              "coordinates"
            ],
            "additionalProperties": true
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "Polygon"
              },
              "coordinates": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    }
                  }
                },
                "description": "Rings of longitude, latitude positions; the first ring is the outline"
              }
            },
            "required": [
              "type",
              "coordinates"
            ],
            "additionalProperties": true
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "MultiPolygon"
              },
              "coordinates": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "number"
                      }
                    }
                  }
                },
                "description": "Polygons, each a list of rings"
              }
            },
            "required": [
              "type",
              "coordinates"
            ],
            "additionalProperties": true
          }
        ]
      },
      "PassportSubstance": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string"
          },
          "materialExternalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "substanceName": {
            "type": "string"
          },
          "casNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "ecNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "regulation": {
            "type": "string",
            "enum": [
              "REACH_SVHC",
              "REACH_ANNEX_XVII",
              "POP",
              "CLP"
            ]
          },
          "concentrationPpm": {
            "type": [
              "number",
              "null"
            ]
          },
          "aboveThreshold": {
            "type": "boolean",
            "description": "Whether the concentration is above the regulation's threshold"
          },
          "scipRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "safeUseInstructions": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "externalId",
          "materialExternalId",
          "substanceName",
          "casNumber",
          "ecNumber",
          "regulation",
          "concentrationPpm",
          "aboveThreshold",
          "scipRef",
          "safeUseInstructions"
        ]
      },
      "PassportSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string",
            "description": "Your id for the passport"
          },
          "granularity": {
            "type": "string",
            "enum": [
              "model",
              "batch",
              "item"
            ],
            "description": "What one passport covers: a product model, a production batch, or a single item"
          },
          "title": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Text by language tag (en, fr, ...)"
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "gtin": {
            "type": [
              "string",
              "null"
            ],
            "description": "GTIN, 8 to 14 digits"
          },
          "batch_lot": {
            "type": [
              "string",
              "null"
            ]
          },
          "serial": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published",
              "archived"
            ]
          },
          "compliance_state": {
            "type": "string",
            "enum": [
              "incomplete",
              "ready",
              "registered",
              "failing"
            ],
            "description": "incomplete: requirements are open; ready: nothing blocking or required is open; registered: not set any more (the only registry is simulated); failing: published with a blocking requirement open"
          },
          "completeness_score": {
            "type": "number",
            "description": "How complete the passport is, 0 to 100"
          },
          "public_enabled": {
            "type": "boolean",
            "description": "Whether the published passport answers anonymous scans"
          },
          "profile": {
            "type": "string",
            "enum": [
              "textile",
              "leather_goods",
              "food_coffee",
              "food_general",
              "appliance",
              "general"
            ],
            "description": "The product profile the passport is scored against"
          },
          "model_passport_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "A batch or item passport's model passport, which it inherits from"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "external_id",
          "granularity",
          "title",
          "brand",
          "category",
          "gtin",
          "batch_lot",
          "serial",
          "status",
          "compliance_state",
          "completeness_score",
          "public_enabled",
          "profile",
          "model_passport_id",
          "updated_at"
        ]
      },
      "PassportUflpaPackage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "description": "UFLPA-001, UFLPA-002, ... per passport"
          },
          "checksum": {
            "type": "string",
            "description": "SHA-256 of the package, hex"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "would_clear",
              "gaps_found",
              "manual_review"
            ],
            "description": "The check's verdict when the package was made"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "package": {
            "type": "object",
            "properties": {
              "schema": {
                "type": "string",
                "description": "The package format, for example dpp.uflpa.package.v1"
              },
              "rulesetVersion": {
                "type": "string"
              },
              "regionsVersion": {
                "type": "string"
              },
              "generatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "product": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string"
                  },
                  "granularity": {
                    "type": "string",
                    "enum": [
                      "model",
                      "batch",
                      "item"
                    ]
                  },
                  "title": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "Text by language tag (en, fr, ...)"
                  },
                  "brand": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "category": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "gtin": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "batchLot": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "serial": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "externalId",
                  "granularity",
                  "title",
                  "brand",
                  "category",
                  "gtin",
                  "batchLot",
                  "serial"
                ]
              },
              "billOfMaterials": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "externalId": {
                      "type": "string"
                    },
                    "parentExternalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "componentName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "materialName": {
                      "type": "string"
                    },
                    "materialClass": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "massSharePct": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "originCountry": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "ISO 3166-1 alpha-2 country code"
                    },
                    "originRegion": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "ISO 3166-2 subdivision code, for example IT-52"
                    },
                    "provenance": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "brand_declared",
                        "supplier_attested",
                        "certificate",
                        null
                      ]
                    },
                    "certificateRef": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "supplier": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "externalId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "countryCode": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "ISO 3166-1 alpha-2 country code"
                        }
                      },
                      "required": [
                        "externalId",
                        "name",
                        "countryCode"
                      ]
                    }
                  },
                  "required": [
                    "externalId",
                    "parentExternalId",
                    "componentName",
                    "materialName",
                    "materialClass",
                    "massSharePct",
                    "originCountry",
                    "originRegion",
                    "provenance",
                    "certificateRef",
                    "supplier"
                  ]
                }
              },
              "custodyChain": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "externalId": {
                      "type": "string"
                    },
                    "fromParty": {
                      "type": "string"
                    },
                    "toParty": {
                      "type": "string"
                    },
                    "fromCountry": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "ISO 3166-1 alpha-2 country code"
                    },
                    "fromRegion": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Absent in packages assembled before transfers carried a region"
                    },
                    "transferDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "materialExternalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "supplierExternalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "quantity": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "uom": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "documentExternalId": {
                            "type": "string"
                          },
                          "evidenceKind": {
                            "type": "string",
                            "enum": [
                              "purchase_order",
                              "invoice",
                              "bill_of_lading",
                              "packing_list",
                              "certificate",
                              "other"
                            ]
                          }
                        },
                        "required": [
                          "documentExternalId",
                          "evidenceKind"
                        ]
                      }
                    }
                  },
                  "required": [
                    "externalId",
                    "fromParty",
                    "toParty",
                    "fromCountry",
                    "transferDate",
                    "materialExternalId",
                    "supplierExternalId",
                    "quantity",
                    "uom",
                    "evidence"
                  ]
                }
              },
              "referencedDocuments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "externalId": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "certificate",
                        "test_report",
                        "declaration_of_conformity",
                        "care_label",
                        "image",
                        "repair_manual",
                        "disassembly_guide",
                        "other"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "issuer": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "standardRef": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "validFrom": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date"
                    },
                    "validUntil": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date"
                    }
                  },
                  "required": [
                    "externalId",
                    "kind",
                    "title",
                    "issuer",
                    "standardRef",
                    "validFrom",
                    "validUntil"
                  ]
                }
              },
              "eudr": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "inScope": {
                    "type": "boolean"
                  },
                  "ready": {
                    "type": "boolean"
                  },
                  "plotCount": {
                    "type": "integer"
                  },
                  "coveredMaterials": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "uncoveredMaterials": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "inScope",
                  "ready",
                  "plotCount",
                  "coveredMaterials",
                  "uncoveredMaterials"
                ]
              },
              "supplierAttestations": {
                "type": "object",
                "properties": {
                  "inScopeMaterials": {
                    "type": "integer"
                  },
                  "byProvenance": {
                    "type": "object",
                    "properties": {
                      "brand_declared": {
                        "type": "integer"
                      },
                      "supplier_attested": {
                        "type": "integer"
                      },
                      "certificate": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "brand_declared",
                      "supplier_attested",
                      "certificate"
                    ]
                  },
                  "suppliers": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "externalId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "countryCode": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "ISO 3166-1 alpha-2 country code"
                        }
                      },
                      "required": [
                        "externalId",
                        "name",
                        "countryCode"
                      ]
                    }
                  }
                },
                "required": [
                  "inScopeMaterials",
                  "byProvenance",
                  "suppliers"
                ]
              },
              "drill": {
                "$ref": "#/components/schemas/PassportUflpaReport"
              }
            },
            "required": [
              "schema",
              "rulesetVersion",
              "regionsVersion",
              "generatedAt",
              "product",
              "billOfMaterials",
              "custodyChain",
              "referencedDocuments",
              "eudr",
              "supplierAttestations",
              "drill"
            ],
            "description": "The evidence as assembled, kept unchanged"
          }
        },
        "required": [
          "id",
          "external_ref",
          "checksum",
          "verdict",
          "note",
          "generated_at",
          "created_at",
          "package"
        ]
      },
      "PassportUflpaReport": {
        "type": "object",
        "properties": {
          "rulesetVersion": {
            "type": "string"
          },
          "regionsVersion": {
            "type": "string"
          },
          "effectiveDate": {
            "type": "string",
            "format": "date"
          },
          "basis": {
            "type": "string"
          },
          "asOf": {
            "type": "string",
            "format": "date"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "would_clear",
              "gaps_found",
              "manual_review"
            ],
            "description": "would_clear: every check passes; gaps_found: at least one fails; manual_review: nothing fails but a person must look"
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pass",
                    "fail",
                    "manual_review",
                    "not_applicable"
                  ]
                },
                "detail": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "remediation": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "What to do; null when the check passes or does not apply"
                },
                "regulationRefs": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id",
                "label",
                "status",
                "detail",
                "remediation",
                "regulationRefs"
              ]
            }
          },
          "counts": {
            "type": "object",
            "properties": {
              "pass": {
                "type": "integer"
              },
              "fail": {
                "type": "integer"
              },
              "manualReview": {
                "type": "integer"
              },
              "notApplicable": {
                "type": "integer"
              }
            },
            "required": [
              "pass",
              "fail",
              "manualReview",
              "notApplicable"
            ]
          }
        },
        "required": [
          "rulesetVersion",
          "regionsVersion",
          "effectiveDate",
          "basis",
          "asOf",
          "verdict",
          "checks",
          "counts"
        ]
      },
      "PassportVersion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "description": "1 for the first publication, counting up"
          },
          "checksum": {
            "type": "string",
            "description": "SHA-256 of the published content, hex"
          },
          "completeness_score": {
            "type": "number"
          },
          "ruleset_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "change_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "published_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "version",
          "checksum",
          "completeness_score",
          "ruleset_version",
          "change_note",
          "published_at"
        ]
      },
      "PlanningComplianceExclusions": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "flag",
              "strict"
            ],
            "description": "The organization's product-compliance mode"
          },
          "excluded": {
            "type": "integer",
            "description": "Needs left out because the movement would not be allowed"
          },
          "excluded_needs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "description": "The recommendation kind it would have been"
                },
                "item": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "from_location": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "to_location": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "code": {
                  "type": "string",
                  "description": "blocked, unknown, no_verdict, recalled, ..."
                },
                "from_country": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "to_country": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "item",
                "from_location",
                "to_location",
                "quantity",
                "code",
                "from_country",
                "to_country",
                "message"
              ]
            },
            "description": "The largest needs left out, at most 50"
          }
        },
        "required": [
          "mode",
          "excluded",
          "excluded_needs"
        ],
        "description": "Present only when the organization has product compliance"
      },
      "PlanningParameterValue": {
        "type": "object",
        "properties": {
          "value": {
            "type": [
              "number",
              "string",
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "The value used; null when the parameter has none (no maximum stock)"
          },
          "origin": {
            "type": "string",
            "enum": [
              "default",
              "observed",
              "stated",
              "request"
            ],
            "description": "default: ours; observed: read from the account's data; stated: set by the account; request: sent with this request"
          },
          "scope": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "org",
              "category",
              "item",
              "item_location",
              "location",
              "supplier",
              "supplier_location",
              "lane",
              null
            ],
            "description": "The scope the value was set at; null for a default or a request value"
          },
          "setBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who set it"
          },
          "setAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "value",
          "origin",
          "scope",
          "setBy",
          "setAt"
        ]
      },
      "PurchaseOrderRisk": {
        "type": "object",
        "properties": {
          "purchase_order": {
            "type": "string",
            "description": "Purchase order external id"
          },
          "supplier": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "external_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "country_code": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "external_id",
              "name",
              "country_code"
            ]
          },
          "status": {
            "type": "string"
          },
          "expected_delivery_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "days_until_expected": {
            "type": [
              "number",
              "null"
            ],
            "description": "Negative when overdue; null without an expected date"
          },
          "risk_score": {
            "type": "number",
            "description": "0-100, higher is riskier"
          },
          "recommended_action": {
            "type": "string",
            "enum": [
              "expedite",
              "monitor",
              "on_track"
            ]
          },
          "factors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "factor": {
                  "type": "string"
                },
                "points": {
                  "type": "number"
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "factor",
                "points",
                "detail"
              ]
            }
          },
          "supplier_slip": {
            "$ref": "#/components/schemas/SupplierDeliverySlip"
          },
          "supplier_updates": {
            "type": "object",
            "properties": {
              "order_days_until_expected": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Days until the order's own date"
              },
              "changes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SupplierInboundChange"
                }
              }
            },
            "required": [
              "order_days_until_expected",
              "changes"
            ],
            "description": "Present when the supplier network changed the order's inbound"
          },
          "critical_item": {
            "type": [
              "string",
              "null"
            ],
            "description": "The item projected to run out before the order arrives"
          },
          "critical_location": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "purchase_order",
          "supplier",
          "status",
          "expected_delivery_date",
          "days_until_expected",
          "risk_score",
          "recommended_action",
          "factors",
          "critical_item",
          "critical_location"
        ]
      },
      "RebalanceRecommendation": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item external id"
          },
          "from_location": {
            "type": "string",
            "description": "Location external id of the donor"
          },
          "to_location": {
            "type": "string",
            "description": "Location external id of the receiver"
          },
          "quantity": {
            "type": "number"
          },
          "priority": {
            "type": "number",
            "description": "0-100, higher first"
          },
          "rationale": {
            "type": "object",
            "properties": {
              "receiver_on_hand": {
                "type": "number"
              },
              "receiver_reorder_point": {
                "type": "number"
              },
              "receiver_days_of_cover": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "receiver_deficit": {
                "type": "number"
              },
              "donor_on_hand": {
                "type": "number"
              },
              "donor_days_of_cover": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Days the donor's stock lasts at its demand plus what it ships to the org's other sites"
              },
              "donor_excess": {
                "type": "number"
              },
              "donor_dead_stock": {
                "type": "boolean",
                "description": "The donor holds the item without selling or shipping it"
              },
              "donor_transfer_out_daily": {
                "type": "number",
                "description": "Units a day the donor ships to the org's other sites, counted in its cover (present when it ships any)"
              },
              "transfer_value": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Quantity at unit cost; null when the item has no cost"
              },
              "lead_time_days": {
                "type": "number"
              },
              "disruption_affected": {
                "type": "boolean"
              },
              "pack": {
                "type": "number",
                "description": "Units per pack the quantity was rounded to"
              },
              "quantity_before_rounding": {
                "type": "number"
              },
              "receiver_room": {
                "type": "number",
                "description": "The receiver's room for the item under its maximum stock"
              },
              "transit_days": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "arrives_before_stockout": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "transfer_cost": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "cost_share": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Transfer cost as a fraction of the transfer value"
              },
              "lead_time_source": {
                "type": "string",
                "enum": [
                  "observed",
                  "stated",
                  "supplier_master",
                  "default"
                ],
                "description": "Where the lead time comes from: receipts observed, the account's own figure, the supplier's master data, or the fallback"
              },
              "service_level": {
                "type": "number"
              },
              "parameters": {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/components/schemas/PlanningParameterValue"
                },
                "description": "The planning parameters behind the row, by parameter key (inventory.service_level, inventory.review_period_days, ...)"
              }
            },
            "required": [
              "receiver_on_hand",
              "receiver_reorder_point",
              "receiver_days_of_cover",
              "receiver_deficit",
              "donor_on_hand",
              "donor_days_of_cover",
              "donor_excess",
              "donor_dead_stock",
              "transfer_value",
              "lead_time_days",
              "disruption_affected"
            ],
            "description": "The figures behind the transfer; a figure that did not apply is absent"
          },
          "expected_impact": {
            "type": "object",
            "properties": {
              "receiver_days_of_cover_after": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "donor_days_of_cover_after": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "stockout_risk_before": {
                "type": "string",
                "enum": [
                  "imminent",
                  "high",
                  "elevated"
                ]
              }
            },
            "required": [
              "receiver_days_of_cover_after",
              "donor_days_of_cover_after",
              "stockout_risk_before"
            ]
          }
        },
        "required": [
          "item",
          "from_location",
          "to_location",
          "quantity",
          "priority",
          "rationale",
          "expected_impact"
        ]
      },
      "RecallExposure": {
        "type": "object",
        "properties": {
          "item": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "external_id": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "external_id",
              "description"
            ]
          },
          "totals": {
            "type": "object",
            "properties": {
              "on_hand": {
                "type": "number"
              },
              "in_transit": {
                "type": "number"
              },
              "locations_with_stock": {
                "type": "integer"
              },
              "open_purchase_quantity": {
                "type": "number",
                "description": "Units of the open purchase-order lines still to arrive"
              },
              "inbound_ship_notice_quantity": {
                "type": "number",
                "description": "Units on ship notices for those lines that are not delivered yet"
              }
            },
            "required": [
              "on_hand",
              "in_transit",
              "locations_with_stock",
              "open_purchase_quantity",
              "inbound_ship_notice_quantity"
            ]
          },
          "locations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "location_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "external_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "location_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "on_hand": {
                  "type": "number"
                },
                "in_transit": {
                  "type": "number"
                },
                "positions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "lot_id": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "uuid"
                      },
                      "lot": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "The lot's external id or lot code"
                      },
                      "expiry_date": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date"
                      },
                      "variant_id": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "uuid"
                      },
                      "on_hand": {
                        "type": "number"
                      },
                      "in_transit": {
                        "type": "number"
                      },
                      "available": {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      "uom": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "as_of": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the stock figure was taken"
                      }
                    },
                    "required": [
                      "lot_id",
                      "lot",
                      "expiry_date",
                      "variant_id",
                      "on_hand",
                      "in_transit",
                      "available",
                      "uom",
                      "as_of"
                    ]
                  },
                  "description": "The stock by lot and variant"
                }
              },
              "required": [
                "location_id",
                "external_id",
                "name",
                "country_code",
                "location_type",
                "on_hand",
                "in_transit",
                "positions"
              ]
            },
            "description": "Locations with stock on hand or in transit, largest first"
          },
          "open_purchase_orders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "purchase_order_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "purchase_order": {
                  "type": "string",
                  "description": "The order's external id"
                },
                "status": {
                  "type": "string"
                },
                "supplier_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "line_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "line_number": {
                  "type": "integer"
                },
                "location_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "location": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The receiving location's external id"
                },
                "variant_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "quantity_open": {
                  "type": "number",
                  "description": "Ordered minus received"
                },
                "expected_delivery_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                }
              },
              "required": [
                "purchase_order_id",
                "purchase_order",
                "status",
                "supplier_id",
                "line_id",
                "line_number",
                "location_id",
                "location",
                "variant_id",
                "quantity_open",
                "expected_delivery_date"
              ]
            },
            "description": "Open purchase-order lines of the item, soonest first"
          },
          "inbound_ship_notices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "asn_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "ship_notice": {
                  "type": "string",
                  "description": "The ship notice's external id"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "accepted",
                    "flagged"
                  ]
                },
                "ship_date": {
                  "type": "string",
                  "format": "date"
                },
                "expected_arrival_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "quantity": {
                  "type": "number"
                },
                "shipment": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "reference": {
                      "type": "string"
                    },
                    "stage": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "predicted_arrival": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date"
                    }
                  },
                  "required": [
                    "reference",
                    "stage",
                    "predicted_arrival"
                  ]
                }
              },
              "required": [
                "asn_id",
                "ship_notice",
                "status",
                "ship_date",
                "expected_arrival_date",
                "quantity",
                "shipment"
              ]
            }
          },
          "trace": {
            "type": "object",
            "properties": {
              "tagged_units": {
                "type": "boolean",
                "description": "Whether tagged units of the item exist"
              },
              "lots": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The lots in stock"
              },
              "item": {
                "type": "string",
                "description": "The item's external id"
              }
            },
            "required": [
              "tagged_units",
              "lots",
              "item"
            ],
            "description": "The lot and item to trace"
          },
          "truncated": {
            "type": "object",
            "properties": {
              "inventory": {
                "type": "boolean"
              },
              "purchase_order_lines": {
                "type": "boolean"
              },
              "ship_notices": {
                "type": "boolean"
              }
            },
            "required": [
              "inventory",
              "purchase_order_lines",
              "ship_notices"
            ],
            "description": "Which of the lists were cut at their read limit"
          }
        },
        "required": [
          "item",
          "totals",
          "locations",
          "open_purchase_orders",
          "inbound_ship_notices",
          "trace",
          "truncated"
        ]
      },
      "RecallHoldTask": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The hold task: a recommendation in the approvals queue"
          },
          "status": {
            "type": "string",
            "enum": [
              "proposed",
              "approved",
              "dismissed",
              "expired",
              "superseded"
            ]
          },
          "location_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ],
            "description": "Units to hold: on hand plus in transit at the location when proposed"
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "description": "The location's external id"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "primary": {
            "type": "boolean",
            "description": "true when this match is the first notice the hold was proposed for; false when it was added to it later"
          },
          "notices_total": {
            "type": "integer",
            "description": "Notices the hold covers"
          },
          "item_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The item held: for a lot made from a recalled input, that lot's item"
          },
          "lot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "A lot-scoped hold: the lot it holds; null for an item-level hold"
          },
          "lot": {
            "type": [
              "string",
              "null"
            ],
            "description": "The lot's external id or lot code"
          },
          "lot_relation": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "named",
              "descendant",
              null
            ],
            "description": "named: a lot the recall names; descendant: a lot made from one"
          }
        },
        "required": [
          "id",
          "status",
          "location_id",
          "quantity",
          "location",
          "created_at",
          "primary",
          "notices_total"
        ]
      },
      "RecallLotExposure": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "lots",
              "no_lot_codes",
              "all_lots",
              "no_lot_matched"
            ],
            "description": "lots: scoped to your lots the recall names; otherwise the whole item, and why"
          },
          "lot_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The lot codes the recall names"
          },
          "matched_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Of those, the codes found on your lots"
          },
          "unmatched_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The codes none of your lots carries"
          },
          "lots": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lot_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "item_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "item": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "item_description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lot_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "external_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expiry_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "relation": {
                  "type": "string",
                  "enum": [
                    "named",
                    "descendant"
                  ]
                },
                "matched_by": {
                  "type": "string",
                  "enum": [
                    "lot_code",
                    "date",
                    "selected",
                    "genealogy"
                  ]
                },
                "made_from": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "description": "For a descendant: the lots it was made from, one step back"
                },
                "depth": {
                  "type": "integer",
                  "description": "Steps from a named lot"
                }
              },
              "required": [
                "lot_id",
                "item_id",
                "item",
                "item_description",
                "lot_code",
                "external_id",
                "expiry_date",
                "relation",
                "matched_by",
                "made_from",
                "depth"
              ]
            },
            "description": "The lots affected: those the recall names, then those made from them (lot genealogy)"
          },
          "stock": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lot_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "item_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "location_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "location": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "location_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "on_hand": {
                  "type": "number"
                },
                "in_transit": {
                  "type": "number"
                },
                "uom": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "lot_id",
                "item_id",
                "location_id",
                "location",
                "location_name",
                "country_code",
                "on_hand",
                "in_transit",
                "uom"
              ]
            },
            "description": "Stock of the affected lots by lot and location, largest first"
          },
          "deliveries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "delivery_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "delivery": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lot_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "item_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "customer_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "customer": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customer_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ship_to": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": "number"
                },
                "uom": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "goods_issued_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "delivery_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                }
              },
              "required": [
                "delivery_id",
                "delivery",
                "lot_id",
                "item_id",
                "customer_id",
                "customer",
                "customer_name",
                "ship_to",
                "quantity",
                "uom",
                "status",
                "goods_issued_at",
                "delivery_date"
              ]
            },
            "description": "Deliveries that shipped the affected lots, newest first"
          },
          "customers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "customer_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "customer": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "deliveries": {
                  "type": "integer"
                },
                "quantity": {
                  "type": "number"
                },
                "lots": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              },
              "required": [
                "customer_id",
                "customer",
                "name",
                "deliveries",
                "quantity",
                "lots"
              ]
            },
            "description": "Who received the affected lots"
          },
          "totals": {
            "type": "object",
            "properties": {
              "lots": {
                "type": "integer"
              },
              "descendant_lots": {
                "type": "integer"
              },
              "on_hand": {
                "type": "number"
              },
              "in_transit": {
                "type": "number"
              },
              "locations_with_stock": {
                "type": "integer"
              },
              "customers": {
                "type": "integer"
              },
              "delivered_quantity": {
                "type": "number"
              }
            },
            "required": [
              "lots",
              "descendant_lots",
              "on_hand",
              "in_transit",
              "locations_with_stock",
              "customers",
              "delivered_quantity"
            ]
          },
          "genealogy": {
            "type": "string",
            "enum": [
              "read",
              "not_available",
              "not_requested"
            ],
            "description": "Whether lots made from the named lots were looked for"
          },
          "truncated": {
            "type": "object",
            "properties": {
              "lots": {
                "type": "boolean"
              },
              "stock": {
                "type": "boolean"
              },
              "deliveries": {
                "type": "boolean"
              },
              "genealogy": {
                "type": "boolean"
              }
            },
            "required": [
              "lots",
              "stock",
              "deliveries",
              "genealogy"
            ],
            "description": "Which lists were cut at their read limit"
          }
        },
        "required": [
          "status",
          "lot_codes",
          "matched_codes",
          "unmatched_codes",
          "lots",
          "stock",
          "deliveries",
          "customers",
          "totals",
          "genealogy",
          "truncated"
        ]
      },
      "RecallMatch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "notice_id": {
            "type": "string",
            "format": "uuid"
          },
          "item_id": {
            "type": "string",
            "format": "uuid"
          },
          "basis": {
            "type": "string",
            "enum": [
              "gtin",
              "brand_model",
              "text"
            ],
            "description": "What matched: the barcode (gtin), the brand and a model number, or the product name"
          },
          "score": {
            "type": "number",
            "description": "How strong the match is, 0 to 1"
          },
          "confirm_ready": {
            "type": "boolean",
            "description": "true for an exact barcode match"
          },
          "status": {
            "type": "string",
            "enum": [
              "candidate",
              "confirmed",
              "dismissed"
            ]
          },
          "evidence": {
            "type": "object",
            "properties": {
              "gtins": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Barcode matches: the GTINs both sides carry"
              },
              "restricted_circulation": {
                "type": "boolean",
                "description": "true when the shared GTIN is an in-store or variable-measure code, which is not globally unique"
              },
              "brand": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "true: the brands agree; null: a side names none"
              },
              "models": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The model numbers both sides carry, normalized"
              },
              "shared_tokens": {
                "type": "integer",
                "description": "Name matches: words of the notice's product name found on the item"
              },
              "notice_tokens": {
                "type": "integer",
                "description": "Name matches: words of the notice's product name compared"
              },
              "lot_codes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Food notices: the lot codes the notice names (they narrow the exposure once confirmed)"
              },
              "all_lots": {
                "type": "boolean",
                "description": "Food notices: true when the notice names every lot"
              }
            },
            "description": "What the match rests on; the fields depend on basis"
          },
          "decided_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "decided_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "decision_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "follow_up_done_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the alert and hold tasks of a confirmation were done; null while pending or not confirmed"
          },
          "follow_up": {
            "type": "object",
            "properties": {
              "status": {
                "const": "pending",
                "description": "Present while a confirmation's follow-up has not run"
              },
              "match_id": {
                "type": "string",
                "format": "uuid"
              },
              "alert": {
                "type": "string",
                "enum": [
                  "raised",
                  "already_raised",
                  "not_subscribed"
                ],
                "description": "not_subscribed: your organization does not receive alerts"
              },
              "webhooks_delivered": {
                "type": "integer"
              },
              "webhooks_pending": {
                "type": "integer",
                "description": "Webhook deliveries still to be retried"
              },
              "holds_proposed": {
                "type": "integer",
                "description": "Hold tasks proposed now, one per location holding the item"
              },
              "holds_existing": {
                "type": "integer",
                "description": "Locations where a hold task already covers the item"
              },
              "holds_notice_added": {
                "type": "integer",
                "description": "Of those, open hold tasks of other notices this notice was added to"
              },
              "locations_with_stock": {
                "type": "integer"
              },
              "exposure_truncated": {
                "type": "boolean",
                "description": "true when the item's stock, orders or ship notices were cut at the read limits"
              },
              "lot_scope": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "lots",
                      "no_lot_codes",
                      "all_lots",
                      "no_lot_matched"
                    ]
                  },
                  "lots": {
                    "type": "integer"
                  },
                  "descendant_lots": {
                    "type": "integer"
                  },
                  "customers": {
                    "type": "integer"
                  }
                },
                "required": [
                  "status",
                  "lots",
                  "descendant_lots",
                  "customers"
                ],
                "description": "Present when the notice names lots or dates: how the holds were scoped"
              },
              "done_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "description": "What the confirmation's follow-up did; empty for a match never confirmed"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "notice_id",
          "item_id",
          "basis",
          "score",
          "confirm_ready",
          "status",
          "evidence",
          "decided_by",
          "decided_at",
          "decision_note",
          "follow_up_done_at",
          "follow_up",
          "created_at",
          "updated_at"
        ]
      },
      "RecallMatchListItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "notice_id": {
            "type": "string",
            "format": "uuid"
          },
          "item_id": {
            "type": "string",
            "format": "uuid"
          },
          "basis": {
            "type": "string",
            "enum": [
              "gtin",
              "brand_model",
              "text"
            ],
            "description": "What matched: the barcode (gtin), the brand and a model number, or the product name"
          },
          "score": {
            "type": "number",
            "description": "How strong the match is, 0 to 1"
          },
          "confirm_ready": {
            "type": "boolean",
            "description": "true for an exact barcode match"
          },
          "status": {
            "type": "string",
            "enum": [
              "candidate",
              "confirmed",
              "dismissed"
            ]
          },
          "evidence": {
            "type": "object",
            "properties": {
              "gtins": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Barcode matches: the GTINs both sides carry"
              },
              "restricted_circulation": {
                "type": "boolean",
                "description": "true when the shared GTIN is an in-store or variable-measure code, which is not globally unique"
              },
              "brand": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "true: the brands agree; null: a side names none"
              },
              "models": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The model numbers both sides carry, normalized"
              },
              "shared_tokens": {
                "type": "integer",
                "description": "Name matches: words of the notice's product name found on the item"
              },
              "notice_tokens": {
                "type": "integer",
                "description": "Name matches: words of the notice's product name compared"
              },
              "lot_codes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Food notices: the lot codes the notice names (they narrow the exposure once confirmed)"
              },
              "all_lots": {
                "type": "boolean",
                "description": "Food notices: true when the notice names every lot"
              }
            },
            "description": "What the match rests on; the fields depend on basis"
          },
          "decided_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "decided_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "decision_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "follow_up_done_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the alert and hold tasks of a confirmation were done; null while pending or not confirmed"
          },
          "follow_up": {
            "type": "object",
            "properties": {
              "status": {
                "const": "pending",
                "description": "Present while a confirmation's follow-up has not run"
              },
              "match_id": {
                "type": "string",
                "format": "uuid"
              },
              "alert": {
                "type": "string",
                "enum": [
                  "raised",
                  "already_raised",
                  "not_subscribed"
                ],
                "description": "not_subscribed: your organization does not receive alerts"
              },
              "webhooks_delivered": {
                "type": "integer"
              },
              "webhooks_pending": {
                "type": "integer",
                "description": "Webhook deliveries still to be retried"
              },
              "holds_proposed": {
                "type": "integer",
                "description": "Hold tasks proposed now, one per location holding the item"
              },
              "holds_existing": {
                "type": "integer",
                "description": "Locations where a hold task already covers the item"
              },
              "holds_notice_added": {
                "type": "integer",
                "description": "Of those, open hold tasks of other notices this notice was added to"
              },
              "locations_with_stock": {
                "type": "integer"
              },
              "exposure_truncated": {
                "type": "boolean",
                "description": "true when the item's stock, orders or ship notices were cut at the read limits"
              },
              "lot_scope": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "lots",
                      "no_lot_codes",
                      "all_lots",
                      "no_lot_matched"
                    ]
                  },
                  "lots": {
                    "type": "integer"
                  },
                  "descendant_lots": {
                    "type": "integer"
                  },
                  "customers": {
                    "type": "integer"
                  }
                },
                "required": [
                  "status",
                  "lots",
                  "descendant_lots",
                  "customers"
                ],
                "description": "Present when the notice names lots or dates: how the holds were scoped"
              },
              "done_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "description": "What the confirmation's follow-up did; empty for a match never confirmed"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "notice": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecallNotice"
              },
              {
                "type": "null"
              }
            ]
          },
          "item": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "external_id": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "external_id",
              "description"
            ]
          }
        },
        "required": [
          "id",
          "notice_id",
          "item_id",
          "basis",
          "score",
          "confirm_ready",
          "status",
          "evidence",
          "decided_by",
          "decided_at",
          "decision_note",
          "follow_up_done_at",
          "follow_up",
          "created_at",
          "updated_at",
          "notice",
          "item"
        ]
      },
      "RecallNotice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "description": "The kind of notice, by jurisdiction: us_consumer_products, eu_consumer_products, uk_consumer_products, ca_recalls, ae_recalls, and the food notices us_food, us_meat_poultry_egg, ca_food and eu_food. More are added over time; `authority` names the regulator"
          },
          "source_id": {
            "type": "string",
            "description": "The notice's id at its publisher"
          },
          "notice_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "published_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "jurisdiction": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country, or EU"
          },
          "product_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The official notice"
          },
          "authority": {
            "type": "string",
            "description": "The authority that issued the notice"
          }
        },
        "required": [
          "id",
          "source",
          "source_id",
          "notice_type",
          "title",
          "published_on",
          "jurisdiction",
          "product_name",
          "brand",
          "url",
          "authority"
        ]
      },
      "RecallNoticeDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "description": "The kind of notice, by jurisdiction: us_consumer_products, eu_consumer_products, uk_consumer_products, ca_recalls, ae_recalls, and the food notices us_food, us_meat_poultry_egg, ca_food and eu_food. More are added over time; `authority` names the regulator"
          },
          "source_id": {
            "type": "string",
            "description": "The notice's id at its publisher"
          },
          "notice_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "published_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "jurisdiction": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country, or EU"
          },
          "product_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The official notice"
          },
          "source_updated_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "When the publisher last changed the notice"
          },
          "model_numbers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "gtins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "GTINs the notice names, as 14 digits"
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "hazard": {
            "type": [
              "string",
              "null"
            ]
          },
          "remedy": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "authority": {
            "type": "string",
            "description": "The authority that issued the notice"
          },
          "code_info": {
            "type": [
              "string",
              "null"
            ],
            "description": "Food notices: the lot and date codes as the publisher wrote them"
          },
          "lot_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Food notices: the lot codes read from the code text (empty when none)"
          },
          "code_dates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "best_by",
                    "use_by",
                    "sell_by",
                    "expiration",
                    "pack_date"
                  ]
                },
                "date": {
                  "type": "string",
                  "description": "YYYY-MM-DD, or YYYY-MM when the notice gives a month"
                }
              },
              "required": [
                "kind",
                "date"
              ]
            },
            "description": "Food notices: dates read from the code text"
          },
          "all_lots": {
            "type": "boolean",
            "description": "true when the notice names every lot (it is not limited to lot codes)"
          },
          "firm": {
            "type": [
              "string",
              "null"
            ],
            "description": "The recalling firm or establishment as published (not a brand)"
          }
        },
        "required": [
          "id",
          "source",
          "source_id",
          "notice_type",
          "title",
          "published_on",
          "jurisdiction",
          "product_name",
          "brand",
          "url",
          "source_updated_on",
          "model_numbers",
          "gtins",
          "category",
          "hazard",
          "remedy",
          "first_seen_at",
          "last_seen_at",
          "authority",
          "code_info",
          "lot_codes",
          "code_dates",
          "all_lots",
          "firm"
        ]
      },
      "RecallOpinion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "match_id": {
            "type": "string",
            "format": "uuid"
          },
          "likelihood": {
            "type": "string",
            "enum": [
              "likely_same_product",
              "possibly_same_product",
              "unlikely_same_product",
              "cannot_tell"
            ]
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string"
                },
                "fields": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "notice_title",
                      "notice_product_name",
                      "notice_brand",
                      "notice_model_numbers",
                      "notice_category",
                      "notice_hazard",
                      "notice_description",
                      "item_description",
                      "item_brand",
                      "item_model",
                      "item_category"
                    ]
                  },
                  "description": "The fields the reason compared"
                }
              },
              "required": [
                "text",
                "fields"
              ]
            },
            "description": "One to three reasons"
          },
          "fields_sent": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "notice_title",
                "notice_product_name",
                "notice_brand",
                "notice_model_numbers",
                "notice_category",
                "notice_hazard",
                "notice_description",
                "item_description",
                "item_brand",
                "item_model",
                "item_category"
              ]
            },
            "description": "The fields of the notice and the item the opinion was given on"
          },
          "fields_seen": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "notice_title",
                "notice_product_name",
                "notice_brand",
                "notice_model_numbers",
                "notice_category",
                "notice_hazard",
                "notice_description",
                "item_description",
                "item_brand",
                "item_model",
                "item_category"
              ]
            },
            "description": "Of those, the fields the opinion says it read"
          },
          "model": {
            "type": "string",
            "description": "Always review-assistant: the opinion is an automated reading of the two records"
          },
          "prompt_version": {
            "type": "string",
            "description": "The version of the instructions the reading followed"
          },
          "input_hash": {
            "type": "string",
            "description": "Identifies the notice and item values the opinion was given on"
          },
          "created_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "current": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the notice and the item still read as they did when the opinion was given; null when not checked"
          },
          "advisory": {
            "const": true,
            "description": "Always true: the opinion decides nothing"
          }
        },
        "required": [
          "id",
          "match_id",
          "likelihood",
          "reasons",
          "fields_sent",
          "fields_seen",
          "model",
          "prompt_version",
          "input_hash",
          "created_by",
          "created_at",
          "current",
          "advisory"
        ]
      },
      "Recommendation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "description": "What is proposed, a lowercase identifier: rebalance, purchase, expedite, markdown, store_replenishment, recall_pull, ... New kinds are added over time"
          },
          "status": {
            "type": "string",
            "enum": [
              "proposed",
              "approved",
              "dismissed",
              "expired",
              "superseded"
            ]
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ],
            "description": "Units to move, buy or act on; null when the kind has no quantity"
          },
          "priority": {
            "type": "number",
            "description": "0 to 100; higher is more urgent"
          },
          "rationale": {
            "type": "object",
            "additionalProperties": true,
            "description": "The figures behind the proposal; the fields depend on kind"
          },
          "expected_impact": {
            "type": "object",
            "additionalProperties": true,
            "description": "What acting on it is expected to change; the fields depend on kind"
          },
          "data_as_of": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "How fresh the data behind it was"
          },
          "status_changed_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The person who approved or dismissed it"
          },
          "status_changed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "superseded_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a newer proposal replaced it"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "item": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "external_id": {
                "type": "string",
                "description": "The item's number in your ERP"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "external_id",
              "description"
            ]
          },
          "from_location": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "external_id": {
                "type": "string",
                "description": "The location's number in your ERP"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "external_id",
              "name"
            ]
          },
          "to_location": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "external_id": {
                "type": "string",
                "description": "The location's number in your ERP"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "external_id",
              "name"
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "quantity",
          "priority",
          "rationale",
          "expected_impact",
          "data_as_of",
          "status_changed_by",
          "status_changed_at",
          "superseded_at",
          "created_at",
          "updated_at",
          "item",
          "from_location",
          "to_location"
        ]
      },
      "RecommendationEvidence": {
        "type": "object",
        "properties": {
          "headline": {
            "type": "string",
            "description": "The proposal in one line"
          },
          "drivers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string",
                  "description": "The figure as text, with its unit"
                },
                "href": {
                  "type": "string",
                  "description": "A link to the record behind the fact, when there is one"
                }
              },
              "required": [
                "label",
                "value"
              ]
            },
            "description": "Why it is proposed: the figures that led to it"
          },
          "cost_benefit": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string",
                  "description": "The figure as text, with its unit"
                },
                "href": {
                  "type": "string",
                  "description": "A link to the record behind the fact, when there is one"
                }
              },
              "required": [
                "label",
                "value"
              ]
            },
            "description": "What it costs and what it is expected to change"
          },
          "confidence": {
            "type": "string",
            "enum": [
              "High",
              "Medium",
              "Low"
            ]
          },
          "confidence_reason": {
            "type": "string"
          },
          "lineage": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string",
                  "description": "The figure as text, with its unit"
                },
                "href": {
                  "type": "string",
                  "description": "A link to the record behind the fact, when there is one"
                }
              },
              "required": [
                "label",
                "value"
              ]
            },
            "description": "How fresh the data is and which records stand behind the proposal"
          }
        },
        "required": [
          "headline",
          "drivers",
          "cost_benefit",
          "confidence",
          "confidence_reason",
          "lineage"
        ]
      },
      "RequestLogEntry": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The X-Request-ID the call was answered with"
          },
          "client_request_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The X-Request-ID your client sent, when it sent one"
          },
          "api_key_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The key the call was made with; it may have been deleted since"
          },
          "environment": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ],
            "description": "test: a key of your sandbox (ic_test_...)"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD"
            ]
          },
          "route": {
            "type": "string",
            "description": "The route as a template, e.g. /passports/{id}: never the ids or the query you sent. (unknown) for a path that is no route, (method not allowed) for a method the path does not take"
          },
          "status": {
            "type": "integer"
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The error object's code, for a failed call"
          },
          "latency_ms": {
            "type": "integer"
          },
          "via": {
            "type": "string",
            "enum": [
              "http",
              "mcp"
            ],
            "description": "mcp: the route behind an MCP tool call"
          },
          "credential": {
            "type": "string",
            "enum": [
              "key",
              "oauth"
            ],
            "description": "oauth: a connected app"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "request_id",
          "client_request_id",
          "api_key_id",
          "environment",
          "method",
          "route",
          "status",
          "error_code",
          "latency_ms",
          "via",
          "credential",
          "created_at"
        ]
      },
      "SizeAllocation": {
        "type": "object",
        "properties": {
          "item": {
            "type": [
              "string",
              "null"
            ],
            "description": "Item external id"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "available_units": {
            "type": "number",
            "description": "On hand across the network"
          },
          "sizes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The item's size codes, in size order"
          },
          "store_allocations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "locationExternalId": {
                  "type": "string"
                },
                "totalUnits": {
                  "type": "integer"
                },
                "demandShare": {
                  "type": "number",
                  "description": "The store's share of the item's demand (0-1)"
                },
                "sizes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "variantCode": {
                        "type": "string"
                      },
                      "units": {
                        "type": "integer"
                      },
                      "sizeShare": {
                        "type": "number",
                        "description": "The size's share of the store's units (0-1)"
                      }
                    },
                    "required": [
                      "variantCode",
                      "units",
                      "sizeShare"
                    ]
                  }
                }
              },
              "required": [
                "locationExternalId",
                "totalUnits",
                "demandShare",
                "sizes"
              ]
            }
          }
        },
        "required": [
          "item",
          "description",
          "available_units",
          "sizes",
          "store_allocations"
        ]
      },
      "SupplierDeliverySlip": {
        "type": "object",
        "properties": {
          "basis": {
            "const": "observed"
          },
          "level": {
            "type": "string",
            "enum": [
              "supplier_plant",
              "supplier"
            ]
          },
          "slip_p90_days": {
            "type": [
              "number",
              "null"
            ],
            "description": "Days late at the 90th percentile of its receipts"
          },
          "slip_p50_days": {
            "type": [
              "number",
              "null"
            ]
          },
          "slip_n": {
            "type": "integer",
            "description": "Receipts in the sample"
          },
          "min_sample": {
            "type": [
              "integer",
              "null"
            ]
          },
          "sufficient": {
            "type": "boolean",
            "description": "Whether the sample is large enough to move a priority or a score"
          },
          "overdue_open_n": {
            "type": "integer",
            "description": "Lines due with nothing received yet"
          },
          "points": {
            "type": "number",
            "description": "Priority or risk points the slip added"
          }
        },
        "required": [
          "basis",
          "level",
          "slip_p90_days",
          "slip_p50_days",
          "slip_n",
          "min_sample",
          "sufficient",
          "overdue_open_n",
          "points"
        ]
      },
      "SupplierInboundChange": {
        "type": "object",
        "properties": {
          "purchase_order": {
            "type": "string",
            "description": "Purchase order external id"
          },
          "kind": {
            "type": "string",
            "enum": [
              "quantity_agreed",
              "date_agreed",
              "late",
              "early",
              "dated_by_shipment",
              "short_closed",
              "over_shipped_ignored"
            ]
          },
          "from": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "The order's value: a date or a quantity"
          },
          "to": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "The value the plan now uses"
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ]
          },
          "days": {
            "type": [
              "number",
              "null"
            ],
            "description": "Days later (positive) or earlier (negative), for a date change"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "purchase_order",
          "kind",
          "from",
          "to",
          "quantity",
          "days",
          "detail"
        ]
      },
      "SyncRun": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "The request that made the run"
          },
          "api_key_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The key that pushed the records; null for a scheduled or manual pull"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "success",
              "partial",
              "failed"
            ]
          },
          "entity_counts": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/IngestEntityCounts"
            },
            "description": "Counts per entity"
          },
          "error_count": {
            "type": "integer",
            "description": "Records refused, in full"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "index": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "The record's position in its entity's batch, from 0"
                },
                "external_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string"
                      },
                      "message": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "field",
                      "message"
                    ]
                  }
                }
              },
              "required": [
                "entity",
                "index",
                "external_id",
                "errors"
              ]
            }
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "duration_ms": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "connection_id",
          "request_id",
          "api_key_id",
          "status",
          "entity_counts",
          "error_count",
          "errors",
          "started_at",
          "finished_at",
          "duration_ms"
        ]
      },
      "TariffAction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "importing_country": {
            "type": "string",
            "enum": [
              "US",
              "CA"
            ],
            "description": "Who charges the duty: the United States, or Canada (its surtax on US goods)"
          },
          "action_type": {
            "type": "string",
            "description": "The action's type, e.g. Section 301, Section 232, IEEPA, Reciprocal Tariff"
          },
          "rate": {
            "type": "number",
            "description": "The rate, read by `rate_type`"
          },
          "rate_type": {
            "type": "string",
            "description": "percentage: `rate` is added to the normal duty. total_floor: `rate` is the total duty"
          },
          "applies_globally": {
            "type": "boolean"
          },
          "affected_countries": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "description": "ISO 3166-1 alpha-2 country code"
            }
          },
          "affected_hs_codes": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "HS codes or prefixes the action covers; empty or null when it names none"
          },
          "excluded_hs_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "except_headings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Schedule headings whose goods this action does not apply to"
          },
          "effective_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "expiry_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "origin": {
            "type": "string",
            "enum": [
              "announcement",
              "schedule",
              "official_list"
            ],
            "description": "schedule: a row of the official tariff schedule. announcement: read from an announcement. official_list: a row of a government's published list (Canada's surtax list)"
          },
          "heading": {
            "type": [
              "string",
              "null"
            ],
            "description": "The tariff schedule heading (schedule rows)"
          },
          "source_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "source_announcement_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The announcement the action was read from (`id` of GET /v1/trade/announcements)"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "announcement": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "title": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "published_date": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            },
            "required": [
              "title",
              "url",
              "published_date"
            ]
          }
        },
        "required": [
          "id",
          "importing_country",
          "action_type",
          "rate",
          "rate_type",
          "applies_globally",
          "affected_countries",
          "affected_hs_codes",
          "excluded_hs_codes",
          "except_headings",
          "effective_date",
          "expiry_date",
          "origin",
          "heading",
          "source_description",
          "source_url",
          "active",
          "source_announcement_id",
          "updated_at",
          "announcement"
        ]
      },
      "TariffAdcvdOrders": {
        "type": "object",
        "properties": {
          "has_adcvd": {
            "type": "boolean",
            "description": "Whether an anti-dumping or countervailing order in force covers the code"
          },
          "total_ad_rate": {
            "type": "number",
            "description": "Sum of the anti-dumping rates that apply, in percent"
          },
          "total_cvd_rate": {
            "type": "number",
            "description": "Sum of the countervailing rates that apply, in percent"
          },
          "total_adcvd_rate": {
            "type": "number",
            "description": "Both together, in percent"
          },
          "orders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "case_number": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The case number; null for GB and EU measures, which carry none"
                },
                "case_type": {
                  "type": "string",
                  "description": "AD (anti-dumping) or CVD (countervailing)"
                },
                "product_description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "rate_percent": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "The rate an importer with no exporter-specific rate pays, in percent; null when not on file"
                },
                "rate_range_min": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Lowest exporter-specific rate, in percent"
                },
                "rate_range_max": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Highest exporter-specific rate, in percent"
                },
                "federal_register_citation": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "effective_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "rate_known": {
                  "type": "boolean",
                  "description": "US only: false when the order applies but its rate is not on file (it is then left out of the totals)"
                },
                "continued_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date",
                  "description": "US only: when the order was last continued"
                },
                "scope_match": {
                  "type": "string",
                  "enum": [
                    "exact",
                    "possible"
                  ],
                  "description": "US only: exact when the code is within the order's scope; possible when the order lists more specific codes than the one sent"
                },
                "matched_hts": {
                  "type": "string",
                  "description": "US only: the code of the order's scope that matched"
                },
                "rate_source": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "US only: where the rate on file comes from: official_notice (the order's published notice) or reviewed (entered by hand from it)"
                },
                "hs_source": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "US only: where the order's scope codes come from, as rate_source"
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "provisional",
                    "definitive"
                  ],
                  "description": "GB and EU only"
                },
                "rate_display": {
                  "type": "string",
                  "description": "GB and EU only: the rate as the tariff words it"
                },
                "exporter_rates": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "additional_code": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "The exporter's additional code as declared"
                      },
                      "exporter": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "rate": {
                        "type": "string"
                      },
                      "rate_percent": {
                        "type": "number"
                      },
                      "conditional": {
                        "type": "boolean",
                        "description": "true when the rate depends on a condition of the measure"
                      },
                      "legal_act": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "additional_code",
                      "exporter",
                      "rate",
                      "rate_percent",
                      "conditional",
                      "legal_act"
                    ]
                  },
                  "description": "GB and EU only: the exporter-specific rates of the measure"
                }
              },
              "required": [
                "case_number",
                "case_type",
                "product_description",
                "rate_percent",
                "rate_range_min",
                "rate_range_max",
                "federal_register_citation",
                "source_url",
                "effective_date"
              ]
            }
          },
          "possible_orders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "case_number": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The case number; null for GB and EU measures, which carry none"
                },
                "case_type": {
                  "type": "string",
                  "description": "AD (anti-dumping) or CVD (countervailing)"
                },
                "product_description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "rate_percent": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "The rate an importer with no exporter-specific rate pays, in percent; null when not on file"
                },
                "rate_range_min": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Lowest exporter-specific rate, in percent"
                },
                "rate_range_max": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Highest exporter-specific rate, in percent"
                },
                "federal_register_citation": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "effective_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "rate_known": {
                  "type": "boolean",
                  "description": "US only: false when the order applies but its rate is not on file (it is then left out of the totals)"
                },
                "continued_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date",
                  "description": "US only: when the order was last continued"
                },
                "scope_match": {
                  "type": "string",
                  "enum": [
                    "exact",
                    "possible"
                  ],
                  "description": "US only: exact when the code is within the order's scope; possible when the order lists more specific codes than the one sent"
                },
                "matched_hts": {
                  "type": "string",
                  "description": "US only: the code of the order's scope that matched"
                },
                "rate_source": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "US only: where the rate on file comes from: official_notice (the order's published notice) or reviewed (entered by hand from it)"
                },
                "hs_source": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "US only: where the order's scope codes come from, as rate_source"
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "provisional",
                    "definitive"
                  ],
                  "description": "GB and EU only"
                },
                "rate_display": {
                  "type": "string",
                  "description": "GB and EU only: the rate as the tariff words it"
                },
                "exporter_rates": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "additional_code": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "The exporter's additional code as declared"
                      },
                      "exporter": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "rate": {
                        "type": "string"
                      },
                      "rate_percent": {
                        "type": "number"
                      },
                      "conditional": {
                        "type": "boolean",
                        "description": "true when the rate depends on a condition of the measure"
                      },
                      "legal_act": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "additional_code",
                      "exporter",
                      "rate",
                      "rate_percent",
                      "conditional",
                      "legal_act"
                    ]
                  },
                  "description": "GB and EU only: the exporter-specific rates of the measure"
                }
              },
              "required": [
                "case_number",
                "case_type",
                "product_description",
                "rate_percent",
                "rate_range_min",
                "rate_range_max",
                "federal_register_citation",
                "source_url",
                "effective_date"
              ]
            },
            "description": "US only: orders that may cover the code (a more specific code is needed to know); not in the totals"
          },
          "rate_warning": {
            "type": "string",
            "description": "US only: what the totals leave out, when they leave something out"
          },
          "lookup_failed": {
            "type": "boolean",
            "description": "US only: true when the orders could not be read; the totals are then 0 and say nothing"
          },
          "note": {
            "type": "string",
            "description": "GB and EU only: how the totals were built"
          }
        },
        "required": [
          "has_adcvd",
          "total_ad_rate",
          "total_cvd_rate",
          "total_adcvd_rate",
          "orders"
        ]
      },
      "TariffAdditionalDuty": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "The kind of additional duty: Section 301, Section 232, Reciprocal Tariff, Import Surcharge, Additional duties, ..."
          },
          "rate": {
            "type": "string",
            "description": "The duty as text, e.g. 15%"
          },
          "rate_percent": {
            "type": "number",
            "description": "Percent of customs value this duty adds"
          },
          "total_rate_percent": {
            "type": "number",
            "description": "US only, on a duty that tops the base rate up to a total: that total. rate_percent is then only the part added"
          },
          "origin": {
            "type": "string",
            "enum": [
              "schedule",
              "announcement"
            ],
            "description": "US only: whether the duty is a heading of the tariff schedule or comes from an official announcement"
          },
          "heading": {
            "type": [
              "string",
              "null"
            ],
            "description": "US only: the tariff schedule heading of the duty; null for a duty from an announcement"
          },
          "source": {
            "type": "string",
            "description": "What imposes the duty"
          },
          "source_url": {
            "type": "string",
            "description": "Link to it; empty when none is on file"
          },
          "published_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the announcement behind the duty was published"
          },
          "metal_weight_condition": {
            "type": "object",
            "properties": {
              "threshold_percent": {
                "type": "number"
              },
              "headings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "charged_as": {
                "type": "string",
                "enum": [
                  "at_or_above_threshold"
                ],
                "description": "rate_percent charges the heading"
              },
              "below_threshold": {
                "type": "object",
                "properties": {
                  "additional_duties": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "heading": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "rate_percent": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type",
                        "heading",
                        "rate_percent"
                      ]
                    }
                  },
                  "additional_percent": {
                    "type": "number"
                  },
                  "effective_ad_valorem_percent": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                },
                "required": [
                  "additional_duties",
                  "additional_percent",
                  "effective_ad_valorem_percent"
                ]
              },
              "source": {
                "type": "string"
              },
              "source_url": {
                "type": "string"
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "threshold_percent",
              "headings",
              "charged_as",
              "below_threshold",
              "source",
              "source_url",
              "note"
            ],
            "description": "US, on a Section 232 duty on a metal derivative: it applies to the full value only when the metal is at least threshold_percent of the article's weight; below_threshold is the answer otherwise"
          }
        },
        "required": [
          "type",
          "rate",
          "rate_percent",
          "source",
          "source_url",
          "published_date"
        ]
      },
      "TariffBaseRate": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "The kind of base duty, in the tariff's own words: MFN Duty, Third country duty, ..."
          },
          "rate": {
            "type": "string",
            "description": "The base rate as the tariff words it (16.5%, Free, 2.4¢/kg + 5%); Unknown when rate_status is unknown"
          },
          "rate_percent": {
            "type": [
              "number",
              "null"
            ],
            "description": "The percent-of-value part of the base rate; 0 for a purely per-unit rate, null when the rate is unknown"
          },
          "source": {
            "type": "string",
            "description": "The name of the tariff schedule the rate was read from; Not available when no rate could be read (rate_status unknown)"
          },
          "source_url": {
            "type": "string",
            "description": "A public page showing the tariff line"
          },
          "special": {
            "type": "string",
            "description": "US only: the line's special-programme rates, as the tariff words them"
          },
          "note": {
            "type": "string",
            "description": "Present when the base rate has a per-unit part or depends on conditions"
          }
        },
        "required": [
          "type",
          "rate",
          "rate_percent",
          "source",
          "source_url"
        ]
      },
      "TariffCheck": {
        "type": "object",
        "properties": {
          "hs_code": {
            "type": "string",
            "description": "The code the answer is for: yours, the classified one, or (GB, EU) the 10-digit line it resolved to"
          },
          "description": {
            "type": "string"
          },
          "origin": {
            "type": "string",
            "description": "Origin country, ISO 3166-1 alpha-2"
          },
          "destination": {
            "type": "string",
            "description": "Destination country, ISO 3166-1 alpha-2 (the same as destination_country)"
          },
          "destination_country": {
            "type": "string"
          },
          "destination_region": {
            "type": "string",
            "enum": [
              "US",
              "GB",
              "EU",
              "CA",
              "AE",
              "SA",
              "EG"
            ],
            "description": "The tariff that applies"
          },
          "base_rate": {
            "$ref": "#/components/schemas/TariffBaseRate"
          },
          "source": {
            "$ref": "#/components/schemas/TariffSource"
          },
          "additional_duties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TariffAdditionalDuty"
            }
          },
          "effective_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Base rate plus additional duties as text; a per-unit part is appended (25.0% + 2.4¢/kg). null when rate_status is unknown"
          },
          "effective_ad_valorem_percent": {
            "type": [
              "number",
              "null"
            ],
            "description": "The percent-of-value part of the effective rate; null when rate_status is unknown"
          },
          "specific_duty": {
            "type": [
              "string",
              "null"
            ],
            "description": "The per-unit part of the base rate, which the percent leaves out; null when there is none"
          },
          "check_date": {
            "type": "string",
            "format": "date",
            "description": "The day the rates are in force for"
          },
          "effective_rate_mfn": {
            "type": [
              "string",
              "null"
            ],
            "description": "With a preferential rate: the effective rate without the preference"
          },
          "effective_rate_preferential": {
            "type": [
              "string",
              "null"
            ],
            "description": "The effective rate with the preference"
          },
          "effective_ad_valorem_percent_preferential": {
            "type": [
              "number",
              "null"
            ]
          },
          "specific_duty_preferential": {
            "type": [
              "string",
              "null"
            ]
          },
          "trade_agreement": {
            "$ref": "#/components/schemas/TariffTradeAgreement"
          },
          "tariff_rate_quota": {
            "type": "object",
            "properties": {
              "has_trq": {
                "type": "boolean",
                "description": "true when the line is subject to a tariff-rate quota and the rates below are both known"
              },
              "is_in_quota": {
                "type": "boolean",
                "description": "US only: true when the code sent is itself the in-quota line"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "preferential",
                  "non_preferential"
                ],
                "description": "GB and EU only"
              },
              "order_number": {
                "type": "string",
                "description": "GB and EU only: the quota's order number"
              },
              "in_quota_rate": {
                "type": "string",
                "description": "The rate inside the quota, as the tariff words it"
              },
              "in_quota_rate_percent": {
                "type": "number",
                "description": "Its percent-of-value part"
              },
              "in_quota_special": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "US only: the in-quota line's special-programme rates"
              },
              "over_quota_rate": {
                "type": "string",
                "description": "The rate once the quota is used up"
              },
              "over_quota_rate_percent": {
                "type": "number"
              },
              "over_quota_hs_code": {
                "type": "string",
                "description": "US only, with is_in_quota: the over-quota line"
              },
              "quota_reference": {
                "type": "string",
                "description": "US only: the tariff's own pointer to the quota's headings"
              },
              "in_quota_preferential_rate": {
                "type": "string",
                "description": "US only: the origin's preferential rate inside the quota"
              },
              "in_quota_preferential_rate_percent": {
                "type": "number"
              },
              "in_quota_program_code": {
                "type": "string",
                "description": "US only: the programme that grants it"
              },
              "status": {
                "type": "string",
                "description": "GB and EU only: the quota's state, e.g. Open, Exhausted"
              },
              "balance": {
                "type": "string",
                "description": "GB and EU only: what is left of the quota"
              },
              "measurement_unit": {
                "type": "string"
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "over_quota_rate",
              "over_quota_rate_percent",
              "note"
            ]
          },
          "adcvd_orders": {
            "$ref": "#/components/schemas/TariffAdcvdOrders"
          },
          "cbp_restrictions": {
            "type": "object",
            "properties": {
              "prohibited": {
                "type": "boolean"
              },
              "prohibited_source": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "curated",
                  "tariff_schedule",
                  "model",
                  null
                ],
                "description": "What set prohibited; model means unverified"
              },
              "column2_prohibited": {
                "type": "boolean",
                "description": "true when the tariff's rate column for countries without normal trade relations prohibits the import"
              },
              "restrictions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "agency": {
                      "type": "string"
                    },
                    "requirement": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "curated",
                        "tariff_schedule",
                        "model"
                      ],
                      "description": "model marks an unverified entry"
                    },
                    "verified": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "agency",
                    "requirement",
                    "source",
                    "verified"
                  ]
                }
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "model_assisted": {
                "type": "boolean",
                "description": "true when a model added a restriction, a note or the prohibited flag"
              },
              "unverified_note": {
                "type": "string",
                "description": "Present when model_assisted: which entries are unverified"
              }
            },
            "required": [
              "prohibited",
              "prohibited_source",
              "column2_prohibited",
              "restrictions",
              "notes",
              "model_assisted"
            ],
            "description": "US only: agency requirements and prohibitions for the code, when any"
          },
          "import_restrictions": {
            "type": "object",
            "properties": {
              "prohibited": {
                "type": "boolean"
              },
              "restrictions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "agency": {
                      "type": "string",
                      "description": "The geographical area the measure names"
                    },
                    "requirement": {
                      "type": "string",
                      "description": "The measure, in the tariff's own words"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prohibition",
                        "control"
                      ]
                    },
                    "measure_type_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "detail": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The measure's footnote or condition text"
                    }
                  },
                  "required": [
                    "agency",
                    "requirement",
                    "kind",
                    "measure_type_id",
                    "detail"
                  ]
                }
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Further lines the tariff attaches: suspensions, low-value consignment duty, ..."
              }
            },
            "required": [
              "prohibited",
              "restrictions",
              "notes"
            ],
            "description": "GB and EU only: import controls, prohibitions and notes on the line, when any"
          },
          "vat": {
            "type": "object",
            "properties": {
              "rate_percent": {
                "type": "number"
              },
              "source": {
                "type": "string"
              },
              "source_url": {
                "type": "string"
              }
            },
            "required": [
              "rate_percent",
              "source",
              "source_url"
            ],
            "description": "GB: the import VAT rate published for the line. CA: the GST on imported goods (5%, by statute). AE and SA: VAT on imports (5% and 15%, by statute). EG: the VAT rate the tariff line states"
          },
          "preferential_treatments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "treatment": {
                  "type": "string",
                  "description": "The tariff treatment code (UST, MXT, CEUT, CPTPT, GPT, ...)"
                },
                "name": {
                  "type": "string"
                },
                "rate": {
                  "type": "string",
                  "description": "The treatment's rate on this line, as the tariff words it"
                },
                "rate_percent": {
                  "type": "number",
                  "description": "Its percent-of-value part"
                },
                "is_specific_rate": {
                  "type": "boolean"
                },
                "source_url": {
                  "type": "string",
                  "description": "The list of countries and the treatments each may claim"
                }
              },
              "required": [
                "treatment",
                "name",
                "rate",
                "rate_percent",
                "is_specific_rate",
                "source_url"
              ]
            },
            "description": "CA, AE, SA and EG: every preferential treatment the origin may claim on this line, best first; available with proof of origin"
          },
          "trade_remedy_measures": {
            "$ref": "#/components/schemas/TariffTradeRemedyMeasures",
            "description": "CA only: anti-dumping and countervailing measures that cover the code and origin. They publish no rate (it is set per exporter), so none is in the duty"
          },
          "uncharged_surtaxes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "The order that names the surtax"
                },
                "rate_percent": {
                  "type": "number"
                },
                "source_url": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "rate_percent",
                "source_url"
              ]
            },
            "description": "CA only: a surtax the law names for this line that is not in the rate, because which of several non-stacking orders applies cannot be told from the code and origin (the Steel Derivative Goods Surtax)"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What to know about the answer. CA, AE, SA and EG: the code matched, preferences that could not be applied, excise, the lists' freshness. US: an announced measure awaiting review (not charged), a code too short for its additional duties, the Section 232 metal-weight condition"
          },
          "related_announcements": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "published_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              },
              "required": [
                "title",
                "url",
                "published_date"
              ]
            },
            "description": "US only: up to 5 official announcements mentioning the code or product, newest first"
          },
          "confidence_score": {
            "type": "number",
            "description": "With item_description: how sure the classification is, 0 to 1"
          },
          "hs_classification_source": {
            "type": "string",
            "enum": [
              "catalog",
              "estimated",
              "schedule"
            ],
            "description": "With item_description: how the code was found. catalog: a reviewed match for the description. schedule: a line of the tariff schedule matched by rule, from your own coded items or the schedule's text. estimated: classified from the description, check it before relying on it"
          },
          "rate_status": {
            "type": "string",
            "enum": [
              "official",
              "estimated",
              "unknown",
              "unverified",
              "confirmed_by_you"
            ],
            "description": "official: read from the tariff schedule; estimated (US): the schedule was unavailable and the rate is an estimate; unknown (US): no rate could be determined (it is not 0%); unverified (SA): the rate is the GCC common tariff's for the code, not Saudi Arabia's own published rate; confirmed_by_you (SA): the rate your organization saved for the code as confirmed"
          },
          "confirmed_rate": {
            "type": "object",
            "properties": {
              "hs_code": {
                "type": "string",
                "description": "Your confirmed line that answered: the code sent, the longest of your codes that covers it, or the line under it"
              },
              "rate_percent": {
                "type": "number",
                "description": "The rate you saved, percent of the customs value"
              },
              "source_note": {
                "type": "string",
                "description": "Who confirmed it and from what, as saved"
              },
              "effective_from": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The day it took effect (YYYY-MM-DD), when saved with one"
              },
              "saved_on": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The day it was last saved (YYYY-MM-DD)"
              },
              "note": {
                "type": "string",
                "description": "The same in a sentence: which of your rates answered, its note and dates, and the rate it stands in place of"
              },
              "common_tariff_rate": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "For comparison: the GCC common tariff's rate for the code, which the answer would have carried as unverified"
              },
              "common_tariff_rate_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The same as a number"
              }
            },
            "required": [
              "hs_code",
              "rate_percent",
              "source_note",
              "effective_from",
              "saved_on",
              "note",
              "common_tariff_rate",
              "common_tariff_rate_percent"
            ],
            "description": "With rate_status confirmed_by_you: your organization's own rate, used as the base rate. Only your organization is answered from it"
          },
          "description_local": {
            "type": "string",
            "description": "AE, SA and EG: the line's description in Arabic, as published"
          },
          "other_charges": {
            "$ref": "#/components/schemas/EgOtherCharges",
            "description": "EG only: what the tariff line states beside the import duty"
          },
          "rate_warning": {
            "type": "string",
            "description": "Present when the rate is estimated, unknown or unverified, or when the code covers several lines with different rates; absent when the rate is your own confirmed one (see confirmed_rate)"
          },
          "hs_match": {
            "type": "object",
            "properties": {
              "typed": {
                "type": "string",
                "description": "The code as sent"
              },
              "matched": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The tariff line used"
              },
              "precision": {
                "type": "string",
                "enum": [
                  "exact",
                  "ambiguous",
                  "ancestor",
                  "none"
                ],
                "description": "exact: the code is a rated line; ambiguous: it covers several rated lines; ancestor: the nearest rated line above it was used"
              },
              "candidate_count": {
                "type": "integer",
                "description": "Rated lines the code covers"
              },
              "rates": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Their distinct rates"
              },
              "additional_duties_by_line": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "same_for_every_line",
                      "depends_on_full_line",
                      "no_lines"
                    ],
                    "description": "same_for_every_line: every line under the code pays the same, so additional_duties is the answer. depends_on_full_line: the lines differ; additional_duties is empty and effective_rate null. no_lines: the lines could not be read; no additional duty is given"
                  },
                  "code": {
                    "type": "string",
                    "description": "The code sent, digits"
                  },
                  "decided_by": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The longer codes the duties name under it"
                  },
                  "lines_source": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "stored_schedule",
                      "live_schedule",
                      null
                    ],
                    "description": "Where the lines came from"
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "hs_code": {
                          "type": "string"
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "additional_duties": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "heading": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "rate_percent": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "type",
                              "heading",
                              "rate_percent"
                            ]
                          }
                        },
                        "additional_percent": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "The line's additional duties summed; null when the line is still too short to decide"
                        }
                      },
                      "required": [
                        "hs_code",
                        "description",
                        "additional_duties",
                        "additional_percent"
                      ]
                    }
                  },
                  "min_additional_percent": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "max_additional_percent": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "effective_rate_min_percent": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "With depends_on_full_line: the lowest percent-of-value rate among the lines"
                  },
                  "effective_rate_max_percent": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "With depends_on_full_line: the highest"
                  }
                },
                "required": [
                  "status",
                  "code",
                  "decided_by",
                  "lines_source",
                  "lines",
                  "min_additional_percent",
                  "max_additional_percent"
                ],
                "description": "US, when the code sent is shorter than codes its additional duties name: each line under it and what it pays"
              }
            },
            "required": [
              "typed"
            ],
            "description": "US, CA, AE, SA and EG: how the code sent mapped to a tariff line"
          },
          "cache_hit": {
            "type": "boolean",
            "description": "true when the answer is a stored one from the last 24 hours for the same code, origin, destination and date; absent otherwise"
          },
          "request_id": {
            "type": "string",
            "description": "Quote this when asking about the request; also the X-Request-ID header"
          }
        },
        "required": [
          "hs_code",
          "description",
          "origin",
          "destination",
          "destination_country",
          "destination_region",
          "base_rate",
          "source",
          "additional_duties",
          "effective_rate",
          "effective_ad_valorem_percent",
          "specific_duty",
          "check_date",
          "request_id"
        ]
      },
      "TariffImpactBrief": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "action_id": {
            "type": "string",
            "format": "uuid",
            "description": "The tariff action the brief is about (`id` of GET /v1/trade/tariff_actions)"
          },
          "action_version": {
            "type": "string",
            "description": "The version of the action the brief was written for"
          },
          "action_type": {
            "type": "string",
            "description": "The action's type, e.g. Section 301"
          },
          "heading": {
            "type": [
              "string",
              "null"
            ],
            "description": "The tariff schedule heading of the action, when it has one"
          },
          "rate_percent": {
            "type": "number"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "ISO 3166-1 alpha-2 country code"
            }
          },
          "applies_globally": {
            "type": "boolean"
          },
          "effective_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "headline": {
            "type": "string"
          },
          "paragraphs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Suggested next steps, one sentence each"
          },
          "text_source": {
            "type": "string",
            "enum": [
              "generated",
              "template"
            ],
            "description": "generated: written for this action from your figures. template: the standard wording filled with your figures"
          },
          "items_count": {
            "type": "integer"
          },
          "suppliers_count": {
            "type": "integer"
          },
          "open_po_count": {
            "type": "integer"
          },
          "open_po_value": {
            "type": "number"
          },
          "exposure": {
            "type": "number",
            "description": "Additional duty on open orders"
          },
          "exposure_basis": {
            "type": "string",
            "enum": [
              "additional",
              "total_floor",
              "total_floor_ceiling"
            ],
            "description": "How `exposure` reads: an added rate, the lift to a total rate, or that lift as an upper bound"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "refreshed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the figures were last recomputed for the same action version"
          }
        },
        "required": [
          "id",
          "action_id",
          "action_version",
          "action_type",
          "heading",
          "rate_percent",
          "countries",
          "applies_globally",
          "effective_date",
          "headline",
          "paragraphs",
          "actions",
          "text_source",
          "items_count",
          "suppliers_count",
          "open_po_count",
          "open_po_value",
          "exposure",
          "exposure_basis",
          "created_at",
          "refreshed_at"
        ]
      },
      "TariffImpactDay": {
        "type": "object",
        "properties": {
          "day": {
            "type": "string",
            "format": "date"
          },
          "exposure": {
            "type": "number",
            "description": "Additional duty on open orders that day"
          },
          "exposure_is_ceiling": {
            "type": "boolean"
          },
          "open_po_value": {
            "type": "number",
            "description": "Open order value the actions in force reached"
          },
          "open_po_value_total": {
            "type": "number",
            "description": "Value of every open order line"
          },
          "items_count": {
            "type": "integer"
          },
          "actions_in_force": {
            "type": "integer"
          },
          "upcoming_exposure": {
            "type": "number"
          },
          "computed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "day",
          "exposure",
          "exposure_is_ceiling",
          "open_po_value",
          "open_po_value_total",
          "items_count",
          "actions_in_force",
          "upcoming_exposure",
          "computed_at"
        ]
      },
      "TariffImpactRollup": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "summary",
              "action",
              "item",
              "supplier"
            ]
          },
          "key": {
            "type": "string",
            "description": "Unique per kind: `org` (summary), the action id (action), `<item id>:<origin country>` (item), the supplier id (supplier)"
          },
          "status": {
            "type": "string",
            "enum": [
              "in_force",
              "upcoming"
            ],
            "description": "in_force: charged today. upcoming: announced, not yet in force (action rows only)"
          },
          "label": {
            "type": "string",
            "description": "The row's name: the action type, the item's external id, the supplier's name; empty on the summary row"
          },
          "exposure": {
            "type": "number",
            "description": "Additional duty on open orders, in the orders' own currency"
          },
          "exposure_is_ceiling": {
            "type": "boolean",
            "description": "true when part of `exposure` is an upper bound (a normal duty rate was not known)"
          },
          "open_po_value": {
            "type": "number",
            "description": "Value still open on the orders the row covers"
          },
          "open_po_count": {
            "type": "integer"
          },
          "items_count": {
            "type": "integer"
          },
          "rate_percent": {
            "type": "number",
            "description": "action: its rate. item: the added rates stacked. supplier and summary: `exposure` as a percentage of `open_po_value`"
          },
          "effective_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "When the action takes effect (action rows); null on other rows"
          },
          "detail": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "as_of": {
                    "type": "string",
                    "format": "date",
                    "description": "The day the figures were computed for"
                  },
                  "open_po_value_total": {
                    "type": "number",
                    "description": "Value of every open order line, checked or not, imported or domestic"
                  },
                  "items_with_hs": {
                    "type": "integer",
                    "description": "Items that carry an HS code of at least 4 digits"
                  },
                  "suppliers_affected": {
                    "type": "integer"
                  },
                  "item_rows": {
                    "type": "integer",
                    "description": "Item rows before the list was cut"
                  },
                  "supplier_rows": {
                    "type": "integer",
                    "description": "Supplier rows before the list was cut"
                  },
                  "actions_in_force": {
                    "type": "integer"
                  },
                  "actions_upcoming": {
                    "type": "integer"
                  },
                  "upcoming_exposure": {
                    "type": "number",
                    "description": "Additional duty the announced actions would add on today's open orders"
                  },
                  "upcoming_is_ceiling": {
                    "type": "boolean"
                  },
                  "ceiling_exposure": {
                    "type": "number",
                    "description": "The part of `exposure` that is an upper bound: duty on items whose normal rate is not known, where the full rate was assumed"
                  },
                  "top_origins": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "exposure": {
                          "type": "number"
                        },
                        "open_po_value": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "country",
                        "exposure",
                        "open_po_value"
                      ]
                    },
                    "description": "The five origins with the most additional duty"
                  },
                  "unchecked": {
                    "type": "object",
                    "properties": {
                      "no_hs_items": {
                        "type": "integer"
                      },
                      "no_hs_open_po_value": {
                        "type": "number"
                      },
                      "no_origin_suppliers": {
                        "type": "integer"
                      },
                      "no_origin_open_po_value": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "no_hs_items",
                      "no_hs_open_po_value",
                      "no_origin_suppliers",
                      "no_origin_open_po_value"
                    ],
                    "description": "Open orders no action could be checked against: items without an HS code, suppliers without a country"
                  }
                },
                "required": [
                  "as_of",
                  "open_po_value_total",
                  "items_with_hs",
                  "suppliers_affected",
                  "item_rows",
                  "supplier_rows",
                  "actions_in_force",
                  "actions_upcoming",
                  "upcoming_exposure",
                  "upcoming_is_ceiling",
                  "ceiling_exposure",
                  "top_origins",
                  "unchecked"
                ],
                "description": "detail of a `summary` row"
              },
              {
                "type": "object",
                "properties": {
                  "action_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The tariff action (`id` of GET /v1/trade/tariff_actions)"
                  },
                  "importing_country": {
                    "type": "string",
                    "enum": [
                      "US",
                      "CA"
                    ],
                    "description": "Who charges the duty; the orders counted are received there. Absent on rows computed before 2026-11-27 (US)"
                  },
                  "type": {
                    "type": "string",
                    "description": "The action's type, e.g. Section 301, Section 232, IEEPA"
                  },
                  "heading": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The tariff schedule heading of the action, when it has one"
                  },
                  "rate_percent": {
                    "type": "number"
                  },
                  "rate_basis": {
                    "type": "string",
                    "enum": [
                      "additional",
                      "total_floor"
                    ],
                    "description": "additional: the rate is added to the normal duty. total_floor: the rate is the total duty, so it adds only what lifts the normal rate to it"
                  },
                  "countries": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "ISO 3166-1 alpha-2 country code"
                    }
                  },
                  "applies_globally": {
                    "type": "boolean"
                  },
                  "effective_date": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "expiry_date": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "source": {
                    "type": "object",
                    "properties": {
                      "tier": {
                        "type": "string",
                        "enum": [
                          "schedule",
                          "announcement"
                        ],
                        "description": "schedule: the action is in the official tariff schedule. announcement: it has been announced and is not in the schedule (yet)"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "url": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "tier",
                      "description",
                      "url"
                    ]
                  },
                  "action_version": {
                    "type": "string",
                    "description": "The version of the action the figures were computed from; with `action_id` it identifies the written brief (GET /v1/trade/tariff_impact/briefs)"
                  },
                  "matched_prefixes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The action's HS codes (digits) that matched at least one of your items"
                  },
                  "suppliers_count": {
                    "type": "integer"
                  },
                  "spend_12m": {
                    "type": "number",
                    "description": "Purchase value of the affected items over the last 12 months"
                  },
                  "items_without_mfn": {
                    "type": "integer",
                    "description": "Affected items whose normal duty rate is not known (total_floor actions: the full rate was charged on them)"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "The item's external id"
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "hs_code": {
                          "type": "string"
                        },
                        "matched_prefix": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The action's HS code the item falls under; null when the action names no codes"
                        },
                        "mfn_rate_percent": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "The item's normal duty rate; null when not known"
                        },
                        "additional_rate_percent": {
                          "type": "number"
                        },
                        "open_po_value": {
                          "type": "number"
                        },
                        "exposure": {
                          "type": "number"
                        },
                        "suppliers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 country code"
                              },
                              "open_pos": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "External ids of up to 5 open orders"
                              }
                            },
                            "required": [
                              "name",
                              "country",
                              "open_pos"
                            ]
                          }
                        }
                      },
                      "required": [
                        "code",
                        "description",
                        "hs_code",
                        "matched_prefix",
                        "mfn_rate_percent",
                        "additional_rate_percent",
                        "open_po_value",
                        "exposure",
                        "suppliers"
                      ]
                    },
                    "description": "The affected items with the most additional duty, at most 25; `items_count` on the row is the full count"
                  },
                  "alternatives": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "External ids of up to 6 affected items this supplier has also supplied"
                        },
                        "spend_12m": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "name",
                        "country",
                        "items",
                        "spend_12m"
                      ]
                    },
                    "description": "Suppliers outside the action's reach that have supplied the affected items, at most 6"
                  },
                  "alternatives_count": {
                    "type": "integer"
                  }
                },
                "required": [
                  "action_id",
                  "type",
                  "heading",
                  "rate_percent",
                  "rate_basis",
                  "countries",
                  "applies_globally",
                  "effective_date",
                  "expiry_date",
                  "source",
                  "action_version",
                  "matched_prefixes",
                  "suppliers_count",
                  "spend_12m",
                  "items_without_mfn",
                  "items",
                  "alternatives",
                  "alternatives_count"
                ],
                "description": "detail of an `action` row"
              },
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "The item's external id"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "hs_code": {
                    "type": "string"
                  },
                  "origin": {
                    "type": "string",
                    "description": "ISO 3166-1 alpha-2 country code"
                  },
                  "mfn_rate_percent": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "The item's normal duty rate; null when not known"
                  },
                  "spend_12m": {
                    "type": "number"
                  },
                  "suppliers": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "open_po_value": {
                          "type": "number"
                        },
                        "open_po_count": {
                          "type": "integer"
                        },
                        "open_pos": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "External ids of up to 5 open orders"
                        }
                      },
                      "required": [
                        "name",
                        "external_id",
                        "open_po_value",
                        "open_po_count",
                        "open_pos"
                      ]
                    },
                    "description": "The item's suppliers in this origin with the most open order value, at most 6"
                  },
                  "suppliers_count": {
                    "type": "integer"
                  },
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "action_id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "The tariff action (`id` of GET /v1/trade/tariff_actions)"
                        },
                        "importing_country": {
                          "type": "string",
                          "enum": [
                            "US",
                            "CA"
                          ],
                          "description": "Who charges the duty; the orders counted are received there. Absent on rows computed before 2026-11-27 (US)"
                        },
                        "type": {
                          "type": "string",
                          "description": "The action's type, e.g. Section 301, Section 232, IEEPA"
                        },
                        "heading": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The tariff schedule heading of the action, when it has one"
                        },
                        "rate_percent": {
                          "type": "number"
                        },
                        "rate_basis": {
                          "type": "string",
                          "enum": [
                            "additional",
                            "total_floor"
                          ],
                          "description": "additional: the rate is added to the normal duty. total_floor: the rate is the total duty, so it adds only what lifts the normal rate to it"
                        },
                        "countries": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "ISO 3166-1 alpha-2 country code"
                          }
                        },
                        "applies_globally": {
                          "type": "boolean"
                        },
                        "effective_date": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date"
                        },
                        "expiry_date": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date"
                        },
                        "source": {
                          "type": "object",
                          "properties": {
                            "tier": {
                              "type": "string",
                              "enum": [
                                "schedule",
                                "announcement"
                              ],
                              "description": "schedule: the action is in the official tariff schedule. announcement: it has been announced and is not in the schedule (yet)"
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "url": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "tier",
                            "description",
                            "url"
                          ]
                        },
                        "matched_prefix": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The action's HS code the item falls under; null when the action names no codes"
                        },
                        "additional_rate_percent": {
                          "type": "number"
                        },
                        "exposure": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "action_id",
                        "type",
                        "heading",
                        "rate_percent",
                        "rate_basis",
                        "countries",
                        "applies_globally",
                        "effective_date",
                        "expiry_date",
                        "source",
                        "matched_prefix",
                        "additional_rate_percent",
                        "exposure"
                      ]
                    },
                    "description": "Every action in force on the item from this origin, highest added rate first"
                  },
                  "not_applied": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "heading": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "rate_percent": {
                          "type": "number"
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "hs_excluded",
                            "carved_out",
                            "exemption",
                            "duplicate_type",
                            "schedule_preferred"
                          ],
                          "description": "Why the action was not charged"
                        }
                      },
                      "required": [
                        "type",
                        "heading",
                        "rate_percent",
                        "reason"
                      ]
                    },
                    "description": "Actions that reach the item and were not charged, at most 6"
                  }
                },
                "required": [
                  "code",
                  "description",
                  "hs_code",
                  "origin",
                  "mfn_rate_percent",
                  "spend_12m",
                  "suppliers",
                  "suppliers_count",
                  "actions",
                  "not_applied"
                ],
                "description": "detail of an `item` row"
              },
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "external_id": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string",
                    "description": "ISO 3166-1 alpha-2 country code"
                  },
                  "spend_12m": {
                    "type": "number"
                  },
                  "open_pos": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "External ids of up to 5 open orders"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "The item's external id"
                        },
                        "hs_code": {
                          "type": "string"
                        },
                        "rate_percent": {
                          "type": "number",
                          "description": "The added rates on the item, stacked"
                        },
                        "open_po_value": {
                          "type": "number"
                        },
                        "exposure": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "code",
                        "hs_code",
                        "rate_percent",
                        "open_po_value",
                        "exposure"
                      ]
                    },
                    "description": "The supplier's affected items with the most additional duty, at most 12; `items_count` on the row is the full count"
                  },
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "action_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "type": {
                          "type": "string"
                        },
                        "heading": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "rate_percent": {
                          "type": "number"
                        },
                        "rate_basis": {
                          "type": "string",
                          "enum": [
                            "additional",
                            "total_floor"
                          ],
                          "description": "additional: the rate is added to the normal duty. total_floor: the rate is the total duty, so it adds only what lifts the normal rate to it"
                        },
                        "exposure": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "action_id",
                        "type",
                        "heading",
                        "rate_percent",
                        "rate_basis",
                        "exposure"
                      ]
                    }
                  }
                },
                "required": [
                  "name",
                  "external_id",
                  "country",
                  "spend_12m",
                  "open_pos",
                  "items",
                  "actions"
                ],
                "description": "detail of a `supplier` row"
              }
            ],
            "description": "The evidence behind the row; its fields depend on `kind`"
          },
          "computed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "kind",
          "key",
          "status",
          "label",
          "exposure",
          "exposure_is_ceiling",
          "open_po_value",
          "open_po_count",
          "items_count",
          "rate_percent",
          "effective_date",
          "detail",
          "computed_at"
        ]
      },
      "TariffSource": {
        "type": "object",
        "properties": {
          "authority": {
            "type": "string",
            "enum": [
              "us_official_schedule",
              "uk_official_schedule",
              "eu_official_schedule",
              "ca_official_schedule",
              "ae_official_schedule",
              "gcc_common_tariff",
              "sa_official_schedule",
              "eg_official_schedule"
            ],
            "description": "Whose official tariff schedule answered: the destination's"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "licence": {
            "type": [
              "string",
              "null"
            ],
            "description": "Attribution wording the tariff's terms of use ask for"
          },
          "as_of": {
            "type": "string",
            "format": "date",
            "description": "The day the rates are in force for"
          }
        },
        "required": [
          "authority",
          "name",
          "url",
          "licence",
          "as_of"
        ]
      },
      "TariffTradeAgreement": {
        "type": "object",
        "properties": {
          "agreement": {
            "type": "string",
            "description": "The agreement or preference the origin can claim"
          },
          "agreement_code": {
            "type": "string"
          },
          "preferential_rate": {
            "type": "string",
            "description": "The preferential rate as the tariff words it; absent when only eligibility is known"
          },
          "preferential_rate_percent": {
            "type": "number",
            "description": "Its percent-of-value part"
          },
          "note": {
            "type": "string",
            "description": "What must hold for the preference to apply"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_trq_rate": {
            "type": "boolean",
            "description": "true when the preferential rate is the in-quota rate of a tariff-rate quota"
          },
          "rules_of_origin": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "agreement_code": {
                  "type": "string"
                },
                "hs_code_prefix": {
                  "type": "string",
                  "description": "The HS prefix the rule covers"
                },
                "rule_type": {
                  "type": "string",
                  "enum": [
                    "tariff_shift",
                    "regional_value_content",
                    "wholly_obtained",
                    "specific_process",
                    "combination"
                  ]
                },
                "rule_description": {
                  "type": "string"
                },
                "rvc_threshold": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Regional value content the goods must reach, in percent"
                },
                "rvc_method": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "transaction_value",
                    "net_cost",
                    "build_up",
                    "build_down",
                    null
                  ],
                  "description": "How regional value content is measured"
                },
                "tariff_shift_rule": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "de_minimis_percent": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Share of non-originating material the rule tolerates, in percent"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "agreement_code",
                "hs_code_prefix",
                "rule_type",
                "rule_description",
                "rvc_threshold",
                "rvc_method",
                "tariff_shift_rule",
                "de_minimis_percent",
                "notes"
              ]
            },
            "description": "US only: the agreement's rules of origin covering this code, when any are on file"
          }
        },
        "required": [
          "agreement",
          "agreement_code",
          "note",
          "source_url"
        ]
      },
      "TariffTradeRemedyMeasures": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "read",
              "not_read"
            ],
            "description": "not_read: the list of measures could not be read, so whether one applies is not known (it is not none)"
          },
          "measures": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "case_type": {
                  "type": "string",
                  "enum": [
                    "AD",
                    "CVD",
                    "UNDERTAKING"
                  ],
                  "description": "AD: dumping; CVD: subsidy; UNDERTAKING: a price undertaking accepted in place of duties"
                },
                "measure_code": {
                  "type": "string",
                  "description": "The authority's code for the measure"
                },
                "product": {
                  "type": "string"
                },
                "country_code": {
                  "type": "string",
                  "description": "ISO 3166-1 alpha-2, or EU"
                },
                "country_name": {
                  "type": "string"
                },
                "scope": {
                  "type": "string",
                  "enum": [
                    "exact",
                    "possible"
                  ],
                  "description": "exact: the measure's numbers cover the line used; possible: only the less specific code sent reaches them"
                },
                "source_url": {
                  "type": "string"
                }
              },
              "required": [
                "case_type",
                "measure_code",
                "product",
                "country_code",
                "country_name",
                "scope",
                "source_url"
              ]
            }
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "measures",
          "note"
        ]
      },
      "TradeAnnouncement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "published_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "source_type": {
            "type": "string",
            "description": "The kind of publication: presidential_action, news, ..."
          },
          "processed": {
            "type": "boolean",
            "description": "Whether tariff actions have been taken from the announcement yet"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "title",
          "url",
          "published_date",
          "source_type",
          "processed",
          "created_at"
        ]
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "recommendation",
                "connector",
                "disruption",
                "tariff_brief",
                "writeback",
                "system_change",
                "recall",
                "party_screening"
              ]
            }
          },
          "active": {
            "type": "boolean"
          },
          "last_delivery_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_delivery_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "How the last delivery ended: the HTTP status your endpoint answered (as text), or one of timeout, unreachable, redirect_refused, blocked_url"
          },
          "created_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "secret_rotated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the signing secret was last rotated"
          },
          "previous_secret_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "After a rotation with an overlap: until when deliveries are also signed with the previous secret"
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "active",
          "last_delivery_at",
          "last_delivery_status",
          "created_by",
          "created_at",
          "updated_at",
          "secret_rotated_at",
          "previous_secret_expires_at"
        ]
      },
      "WebhookDeliveryAttempt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid",
            "description": "The delivery this attempt belongs to: the X-InsightChain-Delivery header your endpoint received"
          },
          "alert_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "event_type": {
            "type": "string",
            "description": "insightchain.<kind>, or insightchain.test"
          },
          "attempt": {
            "type": "integer",
            "description": "1 for the first attempt of the delivery"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "scheduled",
              "event",
              "redeliver",
              "test"
            ],
            "description": "event: sent when the alert was raised. scheduled: a later pass or a retry. redeliver, test: asked for"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "delivered",
              "retry",
              "failed"
            ]
          },
          "status": {
            "type": "string",
            "description": "The HTTP status your endpoint answered (as text), or one of timeout, unreachable, redirect_refused, blocked_url"
          },
          "duration_ms": {
            "type": "integer"
          },
          "next_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the next attempt is planned, for an attempt that will be retried"
          },
          "attempted_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "delivery_id",
          "alert_id",
          "event_type",
          "attempt",
          "trigger",
          "outcome",
          "status",
          "duration_ms",
          "next_attempt_at",
          "attempted_at"
        ]
      },
      "WritebackVerification": {
        "type": "object",
        "properties": {
          "version": {
            "const": 1
          },
          "reference": {
            "type": "object",
            "properties": {
              "field": {
                "type": "string",
                "description": "The ERP field that carries it"
              },
              "value": {
                "type": "string"
              }
            },
            "required": [
              "field",
              "value"
            ],
            "description": "Our reference on the ERP document"
          },
          "document": {
            "type": "string",
            "description": "The document number in the ERP"
          },
          "item": {
            "type": [
              "string",
              "null"
            ],
            "description": "The document line the order is, when known"
          },
          "adopted": {
            "type": "boolean",
            "description": "true when the document was found by our reference instead of created by this attempt"
          },
          "duplicates": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Other documents carrying our reference"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "verified",
              "differences",
              "not_verified"
            ],
            "description": "not_verified: the document could not be read back yet"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "checks": {
            "type": "integer",
            "description": "Read-backs tried so far"
          },
          "error": {
            "type": "string",
            "description": "Why the read-back did not verify (not_verified only)"
          },
          "verified_by": {
            "const": "sync",
            "description": "Present when the read-back could not verify the write and the check after the next sync did"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "description": "The ERP's property name"
                },
                "level": {
                  "type": "string",
                  "enum": [
                    "header",
                    "item"
                  ],
                  "description": "Whether the field is on the document or on its line"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "code",
                    "decimal",
                    "date",
                    "text"
                  ],
                  "description": "How the two values are compared"
                },
                "sent": {
                  "type": "string"
                },
                "stored": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "What the ERP holds; null when it returned none"
                },
                "result": {
                  "type": "string",
                  "enum": [
                    "match",
                    "differs",
                    "missing",
                    "unchecked"
                  ]
                },
                "synced": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Which synced field holds a copy, for the check after the next sync; null when none does"
                }
              },
              "required": [
                "field",
                "level",
                "kind",
                "sent",
                "stored",
                "result",
                "synced"
              ]
            }
          },
          "after_sync": {
            "type": "object",
            "properties": {
              "checked_at": {
                "type": "string",
                "format": "date-time"
              },
              "synced_at": {
                "type": "string",
                "format": "date-time"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "verified",
                  "differences",
                  "changed_since"
                ],
                "description": "changed_since: stored as sent at creation and changed in the ERP later"
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "field": {
                      "type": "string"
                    },
                    "level": {
                      "type": "string",
                      "enum": [
                        "header",
                        "item"
                      ],
                      "description": "Whether the field is on the document or on its line"
                    },
                    "sent": {
                      "type": "string"
                    },
                    "stored": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "synced": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The value in the synced copy"
                    },
                    "result": {
                      "type": "string",
                      "enum": [
                        "match",
                        "differs",
                        "changed_since"
                      ]
                    }
                  },
                  "required": [
                    "field",
                    "level",
                    "sent",
                    "stored",
                    "synced",
                    "result"
                  ]
                }
              }
            },
            "required": [
              "checked_at",
              "synced_at",
              "outcome",
              "fields"
            ],
            "description": "The check against the synced copy after the next sync"
          }
        },
        "required": [
          "version",
          "reference",
          "document",
          "item",
          "adopted",
          "duplicates",
          "outcome",
          "checked_at",
          "checks",
          "fields"
        ]
      },
      "WritebackVerificationSummary": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "verified",
              "differences",
              "not_verified"
            ],
            "description": "not_verified: the document could not be read back yet"
          },
          "adopted": {
            "type": "boolean",
            "description": "true when the document was found by our reference instead of created by this attempt"
          },
          "duplicates": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Other documents carrying our reference"
          },
          "differences": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "sent": {
                  "type": "string"
                },
                "stored": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "field",
                "sent",
                "stored"
              ]
            },
            "description": "Fields the ERP stored differently from what was sent"
          },
          "error": {
            "type": "string",
            "description": "Why the read-back did not verify (not_verified only)"
          }
        },
        "required": [
          "outcome",
          "adopted",
          "duplicates",
          "differences"
        ]
      }
    },
    "headers": {
      "RateLimit-Limit": {
        "schema": {
          "type": "integer"
        },
        "description": "Requests allowed per minute. On every answer to an accepted API key"
      },
      "RateLimit-Remaining": {
        "schema": {
          "type": "integer"
        },
        "description": "Requests left in the current minute window"
      },
      "RateLimit-Reset": {
        "schema": {
          "type": "integer"
        },
        "description": "Seconds until the minute window resets"
      },
      "X-RateLimit-Limit-Day": {
        "schema": {
          "type": "integer"
        },
        "description": "The key's daily quota"
      },
      "X-RateLimit-Remaining-Day": {
        "schema": {
          "type": "integer"
        },
        "description": "Requests left today (resets 00:00 UTC)"
      },
      "X-Request-ID": {
        "schema": {
          "type": "string"
        },
        "description": "Quote this when asking about a request"
      },
      "X-Client-Request-ID": {
        "schema": {
          "type": "string"
        },
        "description": "Your own X-Request-ID request header, echoed. Absent when you sent none"
      },
      "X-InsightChain-Sandbox": {
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        },
        "description": "Present, and true, on every answer to a test key: the data is the sandbox's"
      },
      "Idempotency-Replayed": {
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        },
        "description": "Present, and true, when the answer is the stored answer of an earlier request with the same Idempotency-Key"
      },
      "X-Model-Budget-Limit": {
        "schema": {
          "type": "integer"
        },
        "description": "Calls to AI-assisted routes your organization may make per day"
      },
      "X-Model-Budget-Remaining": {
        "schema": {
          "type": "integer"
        },
        "description": "Of those, the calls left today (resets 00:00 UTC)"
      },
      "Retry-After": {
        "schema": {
          "type": "integer"
        },
        "description": "Seconds to wait before trying again"
      },
      "Allow": {
        "schema": {
          "type": "string"
        },
        "description": "The methods the path takes"
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid input: an unknown or invalid parameter (error.param names it) or a body the route does not accept",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid API key",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The key lacks the scope, or the organization lacks the module or is suspended",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "No such record in your organization",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "The route does not take this method; Allow lists the ones it takes",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          },
          "Allow": {
            "$ref": "#/components/headers/Allow"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "The request conflicts with the record's current state, or its Idempotency-Key is still in use",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "The body, or the data the request would read, is larger than the route allows",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "UnsupportedMediaType": {
        "description": "The Content-Type is not one the route reads",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unprocessable": {
        "description": "Well formed, but it cannot be carried out as sent; or the Idempotency-Key was used with another request",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Per-minute or daily key limit; Retry-After is the real reset",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalError": {
        "description": "Internal error; quote request_id",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "UpstreamError": {
        "description": "The API could not be reached, or a service this route depends on failed. Try again shortly",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "The API, or this route, is not available right now",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Timeout": {
        "description": "The route did not finish in time",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/X-Request-ID"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "X-RateLimit-Limit-Day": {
            "$ref": "#/components/headers/X-RateLimit-Limit-Day"
          },
          "X-RateLimit-Remaining-Day": {
            "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
          },
          "X-Client-Request-ID": {
            "$ref": "#/components/headers/X-Client-Request-ID"
          },
          "X-InsightChain-Sandbox": {
            "$ref": "#/components/headers/X-InsightChain-Sandbox"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/v1/alerts": {
      "get": {
        "operationId": "listAlerts",
        "summary": "Alerts, newest first",
        "description": "Key scope: read (or execute). Module: alerts. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `alerts`, deprecated.",
        "tags": [
          "alerts"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "acknowledged",
                "resolved"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            },
            "description": "Only this kind, exactly as a row's kind field gives it, e.g. recommendation, connector or disruption"
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Alert"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "alerts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Alert"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "alerts",
                    "next_offset",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "ace38181-13ff-4629-bd21-27b5f504c9fc",
                  "alerts": [
                    {
                      "id": "019c6556-7c11-4dd7-a3b3-4477ab043253",
                      "kind": "connector",
                      "severity": "high",
                      "status": "open",
                      "title": "Sync of erp-main has failed three times",
                      "payload": {
                        "connection_id": "4b1d2f0e-6a57-4c1b-9d0f-3f2a5c7e9a10",
                        "connection": "erp-main",
                        "last_sync_status": "failed",
                        "failed_syncs": 3
                      },
                      "assignee": null,
                      "acknowledged_by": null,
                      "acknowledged_at": null,
                      "resolved_by": null,
                      "resolved_at": null,
                      "delivered_to": 1,
                      "created_at": "2026-11-21T15:54:08.642243+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_offset": null,
                  "object": "list",
                  "data": [
                    {
                      "id": "019c6556-7c11-4dd7-a3b3-4477ab043253",
                      "kind": "connector",
                      "severity": "high",
                      "status": "open",
                      "title": "Sync of erp-main has failed three times",
                      "payload": {
                        "connection_id": "4b1d2f0e-6a57-4c1b-9d0f-3f2a5c7e9a10",
                        "connection": "erp-main",
                        "last_sync_status": "failed",
                        "failed_syncs": 3
                      },
                      "assignee": null,
                      "acknowledged_by": null,
                      "acknowledged_at": null,
                      "resolved_by": null,
                      "resolved_at": null,
                      "delivered_to": 1,
                      "created_at": "2026-11-21T15:54:08.642243+00:00"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "alerts",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "alerts"
        }
      }
    },
    "/v1/alerts/{id}": {
      "get": {
        "operationId": "getAlert",
        "summary": "One alert",
        "description": "Key scope: read (or execute). Module: alerts.",
        "tags": [
          "alerts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "alert": {
                      "$ref": "#/components/schemas/Alert"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "alert",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "c365259a-9d9d-44d1-9552-9938a02d4259",
                  "alert": {
                    "id": "019c6556-7c11-4dd7-a3b3-4477ab043253",
                    "kind": "connector",
                    "severity": "high",
                    "status": "open",
                    "title": "Sync of erp-main has failed three times",
                    "payload": {
                      "connection_id": "4b1d2f0e-6a57-4c1b-9d0f-3f2a5c7e9a10",
                      "connection": "erp-main",
                      "last_sync_status": "failed",
                      "failed_syncs": 3
                    },
                    "assignee": null,
                    "acknowledged_by": null,
                    "acknowledged_at": null,
                    "resolved_by": null,
                    "resolved_at": null,
                    "delivered_to": 1,
                    "created_at": "2026-11-21T15:54:08.642243+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "alerts",
        "x-writes": false
      }
    },
    "/v1/alerts/{id}/acknowledge": {
      "post": {
        "operationId": "acknowledgeAlert",
        "summary": "Acknowledge an open alert. Takes no body. The key's creator must still be a member of the organization",
        "description": "Key scope: execute. Module: alerts.",
        "tags": [
          "alerts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "alert": {
                      "$ref": "#/components/schemas/Alert"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "alert",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "70a98867-f1d3-408d-9ea2-bc5c88af6a1a",
                  "alert": {
                    "id": "173c610c-c941-4ccb-bcf7-89c09177e2c6",
                    "kind": "disruption",
                    "severity": "medium",
                    "status": "acknowledged",
                    "title": "Port congestion at Rotterdam reaches 2 of your suppliers",
                    "payload": {
                      "event_id": "8f6f3f0a-2c1b-4f6e-9b7d-5a4c3e2d1f00",
                      "event_type": "port_congestion",
                      "severity": 3,
                      "country_codes": [
                        "NL"
                      ],
                      "affected_suppliers": 2,
                      "value_at_risk": 18250.4
                    },
                    "assignee": null,
                    "acknowledged_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "acknowledged_at": "2026-11-21T16:04:19.514+00:00",
                    "resolved_by": null,
                    "resolved_at": null,
                    "delivered_to": 0,
                    "created_at": "2026-11-21T15:47:24.765241+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "alerts",
        "x-writes": true
      }
    },
    "/v1/alerts/{id}/resolve": {
      "post": {
        "operationId": "resolveAlert",
        "summary": "Resolve an open or acknowledged alert. Takes no body. The key's creator must still be a member of the organization",
        "description": "Key scope: execute. Module: alerts.",
        "tags": [
          "alerts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "alert": {
                      "$ref": "#/components/schemas/Alert"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "alert",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "b61acbaf-83c3-45b3-bdf3-5975815f09ee",
                  "alert": {
                    "id": "173c610c-c941-4ccb-bcf7-89c09177e2c6",
                    "kind": "disruption",
                    "severity": "medium",
                    "status": "resolved",
                    "title": "Port congestion at Rotterdam reaches 2 of your suppliers",
                    "payload": {
                      "event_id": "8f6f3f0a-2c1b-4f6e-9b7d-5a4c3e2d1f00",
                      "event_type": "port_congestion",
                      "severity": 3,
                      "country_codes": [
                        "NL"
                      ],
                      "affected_suppliers": 2,
                      "value_at_risk": 18250.4
                    },
                    "assignee": null,
                    "acknowledged_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "acknowledged_at": "2026-11-21T16:04:19.514+00:00",
                    "resolved_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "resolved_at": "2026-11-21T16:04:19.53+00:00",
                    "delivered_to": 0,
                    "created_at": "2026-11-21T15:47:24.765241+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "alerts",
        "x-writes": true
      }
    },
    "/v1/alerts/{id}/status": {
      "post": {
        "operationId": "setAlertStatus",
        "summary": "Acknowledge or resolve an alert, the status in the body. The same as /acknowledge and /resolve: open to acknowledged or resolved, acknowledged to resolved, anything else is 409. The key's creator must still be a member of the organization",
        "description": "Key scope: execute. Module: alerts.",
        "tags": [
          "alerts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "acknowledged",
                      "resolved"
                    ]
                  }
                },
                "required": [
                  "status"
                ],
                "additionalProperties": false
              },
              "example": {
                "status": "acknowledged"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "alert": {
                      "$ref": "#/components/schemas/Alert"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "alert",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "2a495695-f5dd-4455-bb98-1a374110028a",
                  "alert": {
                    "id": "019c6556-7c11-4dd7-a3b3-4477ab043253",
                    "kind": "connector",
                    "severity": "high",
                    "status": "acknowledged",
                    "title": "Sync of erp-main has failed three times",
                    "payload": {
                      "connection_id": "4b1d2f0e-6a57-4c1b-9d0f-3f2a5c7e9a10",
                      "connection": "erp-main",
                      "last_sync_status": "failed",
                      "failed_syncs": 3
                    },
                    "assignee": null,
                    "acknowledged_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "acknowledged_at": "2026-11-21T16:04:19.488+00:00",
                    "resolved_by": null,
                    "resolved_at": null,
                    "delivered_to": 1,
                    "created_at": "2026-11-21T15:54:08.642243+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "alerts",
        "x-writes": true
      }
    },
    "/v1/api_keys": {
      "get": {
        "operationId": "listApiKeys",
        "summary": "The API keys of your organization, the newest 500 (never a secret). A test key lists the sandbox's keys",
        "description": "Key scope: keys. The key's creator must be an organization admin now. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `keys`, deprecated. At most 500 keys are listed, newest first",
        "tags": [
          "api_keys"
        ],
        "parameters": [
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "live",
                "test"
              ]
            },
            "description": "A key reads its own environment only: the other value returns nothing"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiKey"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "keys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiKey"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "caller": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "description": "api_key for a key"
                        },
                        "role": {
                          "type": "string",
                          "description": "Not sent to an API key"
                        },
                        "org_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "enum": [
                            "live",
                            "test"
                          ]
                        },
                        "sandbox_org_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid",
                          "description": "Not sent to an API key"
                        }
                      },
                      "required": [
                        "org_id"
                      ],
                      "description": "Who asked: for a key, its organization and environment"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "keys",
                    "caller",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "74a3e59a-874a-446c-b33e-3df7c2e80da1",
                  "keys": [
                    {
                      "id": "ed9b1e32-1e24-4ad0-a3b9-0d417e0f4685",
                      "name": "Planning integration",
                      "kind": "key",
                      "environment": "live",
                      "scopes": [
                        "read"
                      ],
                      "active": true,
                      "daily_limit": 10000,
                      "requests_today": 100,
                      "last_reset_date": "2026-11-21",
                      "last_used_at": "2026-11-21T16:04:00+00:00",
                      "expires_at": null,
                      "key_hint": "ic_live_...JgyE",
                      "rotated_at": null,
                      "previous_secret_expires_at": null,
                      "created_at": "2026-11-21T16:03:07.935221+00:00",
                      "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                      "owner_email": "planner@example.com",
                      "org_id": "c3d87f86-a9e9-4129-9605-b13670e4fe0c"
                    }
                  ],
                  "caller": {
                    "kind": "api_key",
                    "org_id": "c3d87f86-a9e9-4129-9605-b13670e4fe0c",
                    "environment": "live"
                  },
                  "object": "list",
                  "data": [
                    {
                      "id": "ed9b1e32-1e24-4ad0-a3b9-0d417e0f4685",
                      "name": "Planning integration",
                      "kind": "key",
                      "environment": "live",
                      "scopes": [
                        "read"
                      ],
                      "active": true,
                      "daily_limit": 10000,
                      "requests_today": 100,
                      "last_reset_date": "2026-11-21",
                      "last_used_at": "2026-11-21T16:04:00+00:00",
                      "expires_at": null,
                      "key_hint": "ic_live_...JgyE",
                      "rotated_at": null,
                      "previous_secret_expires_at": null,
                      "created_at": "2026-11-21T16:03:07.935221+00:00",
                      "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                      "owner_email": "planner@example.com",
                      "org_id": "c3d87f86-a9e9-4129-9605-b13670e4fe0c"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "keys",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "keys"
        }
      },
      "post": {
        "operationId": "createApiKey",
        "summary": "Create a key; its secret is in this response only. Its scopes must be scopes the calling key holds. 30 key changes an hour per calling key (429 above)",
        "description": "Key scope: keys. The key's creator must be an organization admin now.",
        "tags": [
          "api_keys"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "read",
                        "ingest",
                        "execute",
                        "approve",
                        "keys"
                      ]
                    },
                    "minItems": 1,
                    "description": "A key can only hand out scopes it holds itself (execute counts as holding read)",
                    "default": [
                      "read"
                    ]
                  },
                  "daily_limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000,
                    "default": 1000,
                    "description": "Requests a day"
                  },
                  "expires_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "When the key stops working: a date-time (not a bare date) at least one minute and at most five years from now; null for a key that does not expire"
                  },
                  "environment": {
                    "type": "string",
                    "enum": [
                      "live",
                      "test"
                    ],
                    "description": "Must be the calling key's own environment (the default); a key cannot create keys for the other one"
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              },
              "example": {
                "name": "Warehouse sync",
                "scopes": [
                  "read",
                  "ingest"
                ],
                "daily_limit": 2000,
                "expires_at": "2027-12-31T00:00:00Z"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "$ref": "#/components/schemas/ApiKey"
                    },
                    "secret": {
                      "type": "string",
                      "description": "The key's secret. Shown in this response only; store it now"
                    },
                    "plaintext": {
                      "type": "string",
                      "deprecated": true,
                      "description": "Deprecated: the same value as `secret`"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "key",
                    "secret",
                    "plaintext",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "32bbb502-8839-448b-bf9e-16048773c7c2",
                  "key": {
                    "id": "8c1bb392-ffb1-40a6-a98e-7dcef4229aa8",
                    "name": "Warehouse sync",
                    "kind": "key",
                    "environment": "live",
                    "scopes": [
                      "read"
                    ],
                    "active": true,
                    "daily_limit": 1000,
                    "requests_today": 0,
                    "last_reset_date": "2026-11-21",
                    "last_used_at": null,
                    "expires_at": "2026-11-22T16:04:19.894+00:00",
                    "key_hint": "ic_live_...VoJM",
                    "rotated_at": null,
                    "previous_secret_expires_at": null,
                    "created_at": "2026-11-21T16:04:19.904971+00:00",
                    "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "owner_email": "planner@example.com",
                    "org_id": "c3d87f86-a9e9-4129-9605-b13670e4fe0c"
                  },
                  "secret": "shown-once-example-value",
                  "plaintext": "shown-once-example-value"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "keys",
        "x-module": null,
        "x-writes": true
      }
    },
    "/v1/api_keys/{id}": {
      "get": {
        "operationId": "getApiKey",
        "summary": "One key (never its secret)",
        "description": "Key scope: keys. The key's creator must be an organization admin now.",
        "tags": [
          "api_keys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "$ref": "#/components/schemas/ApiKey"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "key",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "d9a66a63-794c-4fb6-8d4b-8281807e0170",
                  "key": {
                    "id": "8c1bb392-ffb1-40a6-a98e-7dcef4229aa8",
                    "name": "Warehouse sync",
                    "kind": "key",
                    "environment": "live",
                    "scopes": [
                      "read"
                    ],
                    "active": true,
                    "daily_limit": 1000,
                    "requests_today": 0,
                    "last_reset_date": "2026-11-21",
                    "last_used_at": null,
                    "expires_at": "2026-11-22T16:04:19.894+00:00",
                    "key_hint": "ic_live_...VoJM",
                    "rotated_at": null,
                    "previous_secret_expires_at": null,
                    "created_at": "2026-11-21T16:04:19.904971+00:00",
                    "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "owner_email": "planner@example.com",
                    "org_id": "c3d87f86-a9e9-4129-9605-b13670e4fe0c"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "keys",
        "x-module": null,
        "x-writes": false
      },
      "patch": {
        "operationId": "updateApiKey",
        "summary": "Change a key's name, scopes, expiry, daily limit or active flag. At least one of them is required. A key that holds a scope the calling key lacks can only be switched off or revoked. 30 key changes an hour per calling key (429 above)",
        "description": "Key scope: keys. The key's creator must be an organization admin now.",
        "tags": [
          "api_keys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "read",
                        "ingest",
                        "execute",
                        "approve",
                        "keys"
                      ]
                    },
                    "minItems": 1,
                    "description": "A key can only hand out scopes it holds itself (execute counts as holding read)"
                  },
                  "expires_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "When the key stops working: a date-time (not a bare date) at least one minute and at most five years from now; null for a key that does not expire"
                  },
                  "daily_limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              },
              "example": {
                "name": "Warehouse sync, east",
                "daily_limit": 5000
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "$ref": "#/components/schemas/ApiKey"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "key",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "ede776fd-c40b-4868-92a8-76dc3862975b",
                  "key": {
                    "id": "8c1bb392-ffb1-40a6-a98e-7dcef4229aa8",
                    "name": "Warehouse sync (EU)",
                    "kind": "key",
                    "environment": "live",
                    "scopes": [
                      "read"
                    ],
                    "active": true,
                    "daily_limit": 500,
                    "requests_today": 0,
                    "last_reset_date": "2026-11-21",
                    "last_used_at": null,
                    "expires_at": "2026-11-22T16:04:19.894+00:00",
                    "key_hint": "ic_live_...VoJM",
                    "rotated_at": null,
                    "previous_secret_expires_at": null,
                    "created_at": "2026-11-21T16:04:19.904971+00:00",
                    "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "owner_email": "planner@example.com",
                    "org_id": "c3d87f86-a9e9-4129-9605-b13670e4fe0c"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "keys",
        "x-module": null,
        "x-writes": true
      },
      "delete": {
        "operationId": "revokeApiKey",
        "summary": "Revoke a key: it stops working at once. 30 key changes an hour per calling key (429 above)",
        "description": "Key scope: keys. The key's creator must be an organization admin now.",
        "tags": [
          "api_keys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "const": true
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "deleted",
                    "id",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "34111f69-7030-487f-8824-44b4cf64f077",
                  "deleted": true,
                  "id": "8c1bb392-ffb1-40a6-a98e-7dcef4229aa8"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "keys",
        "x-module": null,
        "x-writes": true
      }
    },
    "/v1/api_keys/{id}/rotate": {
      "post": {
        "operationId": "rotateApiKey",
        "summary": "A new secret for a key, in this response only. With overlap_seconds the old secret keeps working until the window ends. A key cannot rotate a key that holds a scope it lacks. 30 key changes an hour per calling key (429 above)",
        "description": "Key scope: keys. The key's creator must be an organization admin now.",
        "tags": [
          "api_keys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "overlap_seconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 604800,
                    "default": 0,
                    "description": "How long the old secret keeps working. 0, the default: it stops now"
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "overlap_seconds": 86400
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "$ref": "#/components/schemas/ApiKey"
                    },
                    "secret": {
                      "type": "string",
                      "description": "The key's secret. Shown in this response only; store it now"
                    },
                    "previous_secret_expires_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "Until when the previous secret still works; null: it stopped now"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "key",
                    "secret",
                    "previous_secret_expires_at",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "aa9888e7-e550-4672-80f0-1313adce0851",
                  "key": {
                    "id": "8c1bb392-ffb1-40a6-a98e-7dcef4229aa8",
                    "name": "Warehouse sync (EU)",
                    "kind": "key",
                    "environment": "live",
                    "scopes": [
                      "read"
                    ],
                    "active": true,
                    "daily_limit": 500,
                    "requests_today": 0,
                    "last_reset_date": "2026-11-21",
                    "last_used_at": null,
                    "expires_at": "2026-11-22T16:04:19.894+00:00",
                    "key_hint": "ic_live_...rb10",
                    "rotated_at": "2026-11-21T16:04:19.947644+00:00",
                    "previous_secret_expires_at": "2026-11-21T16:05:19.947+00:00",
                    "created_at": "2026-11-21T16:04:19.904971+00:00",
                    "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "owner_email": "planner@example.com",
                    "org_id": "c3d87f86-a9e9-4129-9605-b13670e4fe0c"
                  },
                  "secret": "shown-once-example-value",
                  "previous_secret_expires_at": "2026-11-21T16:05:19.947Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "keys",
        "x-module": null,
        "x-writes": true
      }
    },
    "/v1/compliance/check": {
      "get": {
        "operationId": "getComplianceCheck",
        "summary": "The stored admissibility verdict for one of your items in a country (blocked, conditional, clear or unknown) with its scope, reasons and sources, or a not-computed state saying why there is none",
        "description": "Key scope: read (or execute). Module: product_compliance.",
        "tags": [
          "compliance"
        ],
        "parameters": [
          {
            "name": "item",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "The item's external id"
          },
          {
            "name": "country",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "ISO 3166-1 alpha-2 country code (UK is read as GB; an EU member state, not EU)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "item": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "external_id",
                        "description"
                      ]
                    },
                    "country": {
                      "type": "string",
                      "description": "ISO 3166-1 alpha-2"
                    },
                    "computed": {
                      "type": "boolean",
                      "description": "Whether a verdict is stored for the item in the country. false: verdict is null, scope is empty, not_computed says why, and the fields of a stored verdict are absent"
                    },
                    "verdict": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "blocked",
                        "conditional",
                        "clear",
                        "unknown",
                        null
                      ]
                    },
                    "scope": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "import_measures",
                          "conformity",
                          "technical_fit"
                        ]
                      },
                      "description": "The dimensions the answer is complete for. A clear verdict says nothing beyond them"
                    },
                    "unknown_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "commodity_code_not_found",
                          "commodity_code_too_general",
                          "destination_code_mismatch",
                          "destination_code_not_found",
                          "intra_eu_movement",
                          "invalid_commodity_code",
                          "invalid_destination",
                          "invalid_rule_conditions",
                          "lookup_failed",
                          "no_commodity_code",
                          "no_origin",
                          "not_covered",
                          "rule_needs_attributes",
                          "rule_needs_review",
                          "stale_rule_set",
                          "unreviewed_rule_set",
                          "unsupported_destination"
                        ]
                      },
                      "description": "Every unknown found; never empty when the verdict is unknown"
                    },
                    "reasons": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ComplianceReason"
                      }
                    },
                    "unknown_causes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "coverage",
                          "item_data",
                          "review",
                          "source"
                        ]
                      },
                      "description": "Why the unknowns: coverage (nothing in your data changes it), item_data (the item's data can fix it), review (a person must judge a fact), source (an official tariff could not be read)"
                    },
                    "rule_ids": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "description": "The rules behind the answer"
                    },
                    "rule_set_version": {
                      "type": "string",
                      "description": "An opaque version of what the verdict was computed from. Compare it for equality: it changes when the rules or the tariff reads behind the verdict change"
                    },
                    "commodity_code": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The item's commodity code the verdict was computed for, digits only"
                    },
                    "origins": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The origin countries the verdict was computed for"
                    },
                    "origin_basis": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "item",
                        "suppliers",
                        "none",
                        null
                      ],
                      "description": "Where the origins came from: item (the item's own country of origin, which wins), suppliers (the countries of the suppliers on its purchase orders), none; null on a verdict computed before this was recorded"
                    },
                    "computed_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "true when the verdict may no longer describe the item"
                    },
                    "stale_reasons": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "computed_over_48h_ago",
                          "commodity_code_changed"
                        ]
                      }
                    },
                    "not_computed": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "not_a_destination",
                            "destination_capped",
                            "not_yet_computed"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "fix": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "fix"
                      ],
                      "description": "Why there is no stored verdict, and what to do"
                    },
                    "disclaimer": {
                      "type": "string",
                      "description": "A fixed sentence: not legal advice, and what a clear verdict does and does not cover"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "item",
                    "country",
                    "computed",
                    "verdict",
                    "scope",
                    "disclaimer",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "790bef40-e0bb-4dc2-a5e3-a07e8b76f0ed",
                  "item": {
                    "id": "b8e90b6b-3fc8-4f09-8445-e718b3ac693b",
                    "external_id": "000123",
                    "description": "Cotton Oxford Shirt"
                  },
                  "country": "US",
                  "computed": true,
                  "verdict": "unknown",
                  "scope": [
                    "technical_fit"
                  ],
                  "unknown_codes": [
                    "not_covered"
                  ],
                  "reasons": [
                    {
                      "kind": "rule",
                      "origins": null,
                      "rule_id": "019eeda1-4169-4149-8953-f8bc4127bbe4",
                      "verdict": "conditional",
                      "rule_ref": "r-5b1e0c7a9d2f4a36",
                      "authority": "FTC",
                      "rule_type": "conformity",
                      "source_url": "https://www.ftc.gov",
                      "certificate": {
                        "check": null,
                        "status": "not_specified",
                        "documents": [],
                        "standards": [],
                        "certificate_id": null,
                        "certificate_valid_from": null,
                        "certificate_valid_until": null
                      },
                      "requirement": "FTC textile labeling requirements (fiber content, country of origin, manufacturer).",
                      "satisfied_by": {},
                      "source_read_on": "2026-11-18"
                    }
                  ],
                  "unknown_causes": [
                    "coverage"
                  ],
                  "rule_ids": [
                    "019eeda1-4169-4149-8953-f8bc4127bbe4"
                  ],
                  "rule_set_version": "v-7ed5a66deab3ac63",
                  "commodity_code": "6205202026",
                  "origins": [
                    "VN"
                  ],
                  "computed_at": "2026-11-21T10:55:52.552+00:00",
                  "stale": false,
                  "stale_reasons": [],
                  "disclaimer": "Not legal advice. A verdict reports the rules and official measures on file for the date shown, with their sources. A clear verdict cover..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "product_compliance",
        "x-writes": false
      },
      "post": {
        "operationId": "createComplianceCheck",
        "summary": "An admissibility verdict for a commodity code from up to 5 origin countries into a destination, with no item on file. Stores nothing for your organization. 30 a minute per key (429 above); the body is at most 16 KB (413 above)",
        "description": "Key scope: read (or execute). Module: product_compliance.",
        "tags": [
          "compliance"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "commodity_code": {
                    "type": "string",
                    "maxLength": 17,
                    "description": "Commodity code, 6 to 12 digits; dots between groups are allowed. More than 10 digits is a Gulf tariff line: matched in full for SA and AE, on its first six digits (the international subheading) for any other destination, where the answer carries a code_shortened reason"
                  },
                  "origin_countries": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Za-z]{2}$",
                      "description": "ISO 3166-1 alpha-2 country code (UK is read as GB; an EU member state, not EU)"
                    },
                    "minItems": 1,
                    "maxItems": 5,
                    "description": "Countries the goods come from"
                  },
                  "destination": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "ISO 3166-1 alpha-2 country code (UK is read as GB; an EU member state, not EU)"
                  },
                  "attributes": {
                    "type": "object",
                    "properties": {
                      "gtin": {
                        "type": "string",
                        "maxLength": 14,
                        "description": "GTIN-8, 12, 13 or 14 with a valid check digit (stored as 14 digits)"
                      },
                      "brand": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "model": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "product_class": {
                        "type": "string",
                        "enum": [
                          "toy",
                          "child_restraint",
                          "childcare_article",
                          "electrical_appliance",
                          "electronic_device",
                          "radio_equipment",
                          "lighting",
                          "battery",
                          "cosmetic",
                          "textile_apparel",
                          "footwear",
                          "furniture",
                          "food_contact_material",
                          "machinery",
                          "personal_protective_equipment",
                          "medical_device",
                          "other"
                        ]
                      },
                      "plug_type": {
                        "type": "string",
                        "enum": [
                          "A",
                          "B",
                          "C",
                          "D",
                          "E",
                          "F",
                          "G",
                          "H",
                          "I",
                          "J",
                          "K",
                          "L",
                          "M",
                          "N",
                          "O"
                        ],
                        "description": "Plug type letter"
                      },
                      "voltage_range": {
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000
                          }
                        },
                        "required": [
                          "min",
                          "max"
                        ],
                        "additionalProperties": false
                      },
                      "frequency_hz": {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "enum": [
                            50,
                            60
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 2,
                        "description": "Mains frequencies it is rated for"
                      },
                      "radio": {
                        "type": "boolean",
                        "description": "Contains a radio or wireless transmitter"
                      },
                      "mains_powered": {
                        "type": "boolean",
                        "description": "Connects to mains power"
                      },
                      "battery_chemistry": {
                        "type": "string",
                        "enum": [
                          "none",
                          "lithium_ion",
                          "lithium_metal",
                          "nickel_metal_hydride",
                          "nickel_cadmium",
                          "alkaline",
                          "lead_acid",
                          "zinc_carbon",
                          "silver_oxide",
                          "other"
                        ]
                      },
                      "age_grade": {
                        "type": "object",
                        "properties": {
                          "min_months": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 1200
                          },
                          "max_months": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1200,
                            "description": "null: open-ended"
                          }
                        },
                        "required": [
                          "min_months"
                        ],
                        "additionalProperties": false
                      },
                      "contains_seal_products": {
                        "type": "boolean",
                        "description": "Contains seal products. false is the statement behind the official waiver Y032 of the import control on seal products"
                      },
                      "contains_cat_dog_fur": {
                        "type": "boolean",
                        "description": "Contains cat or dog fur. false is the statement behind the official waiver Y922 of the import control on cat and dog fur"
                      },
                      "contains_cites_species": {
                        "type": "boolean",
                        "description": "Contains a specimen, part or derivative of a CITES-listed species. false is the statement behind the official waiver Y900 of the CITES import control"
                      },
                      "is_torture_repression_goods": {
                        "type": "boolean",
                        "description": "The goods are of a kind the anti-torture regulation lists (described in the measure's TR footnotes). false is the statement behind the official waiver Y904 of the import control on goods for torture and repression"
                      },
                      "is_waste": {
                        "type": "boolean",
                        "description": "The goods are waste under the waste shipments regulation (EC) No 1013/2006. false is the statement behind the official waiver Y923 of the import control on waste"
                      },
                      "contains_ivory": {
                        "type": "boolean",
                        "description": "Contains ivory. false is the statement behind the UK's document 9037 (goods do not contain ivory) of its ivory import control"
                      },
                      "organic": {
                        "type": "boolean",
                        "description": "Sold, labelled or represented as organic. true: the destination's organic import rules apply (in the US, NOP Import Certificate data at entry, 7 CFR 205.273)"
                      },
                      "commodity_code_gb": {
                        "type": "string",
                        "pattern": "^[0-9][0-9. ]{6,15}[0-9]$",
                        "maxLength": 17,
                        "description": "The item's commodity code in the UK tariff, 10 digits (or 8); dots and spaces ignored. GB verdicts read that line only. Its first six digits must equal the item's commodity code's"
                      },
                      "commodity_code_eu": {
                        "type": "string",
                        "pattern": "^[0-9][0-9. ]{6,15}[0-9]$",
                        "maxLength": 17,
                        "description": "The item's commodity code in the EU tariff: TARIC, 10 digits, or CN, 8; dots and spaces ignored. EU verdicts read that line (or the lines under the CN code) only. Its first six digits must equal the item's commodity code's"
                      }
                    },
                    "additionalProperties": false,
                    "description": "Product attributes for this check only (plug type, rated voltage and the like)"
                  }
                },
                "required": [
                  "commodity_code",
                  "origin_countries",
                  "destination"
                ],
                "additionalProperties": false
              },
              "example": {
                "commodity_code": "8516.31",
                "origin_countries": [
                  "CN"
                ],
                "destination": "GB",
                "attributes": {
                  "plug_type": "G",
                  "voltage_range": {
                    "min": 220,
                    "max": 240
                  },
                  "frequency_hz": [
                    50
                  ],
                  "mains_powered": true
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "check": {
                      "type": "object",
                      "properties": {
                        "commodity_code": {
                          "type": "string",
                          "description": "Digits only"
                        },
                        "origins": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "destination": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2"
                        },
                        "as_of": {
                          "type": "string",
                          "format": "date",
                          "description": "The day the answer is for"
                        },
                        "attributes": {
                          "type": "object",
                          "properties": {
                            "gtin": {
                              "type": "string"
                            },
                            "brand": {
                              "type": "string"
                            },
                            "model": {
                              "type": "string"
                            },
                            "product_class": {
                              "type": "string",
                              "enum": [
                                "toy",
                                "child_restraint",
                                "childcare_article",
                                "electrical_appliance",
                                "electronic_device",
                                "radio_equipment",
                                "lighting",
                                "battery",
                                "cosmetic",
                                "textile_apparel",
                                "footwear",
                                "furniture",
                                "food_contact_material",
                                "machinery",
                                "personal_protective_equipment",
                                "medical_device",
                                "other"
                              ]
                            },
                            "plug_type": {
                              "type": "string",
                              "enum": [
                                "A",
                                "B",
                                "C",
                                "D",
                                "E",
                                "F",
                                "G",
                                "H",
                                "I",
                                "J",
                                "K",
                                "L",
                                "M",
                                "N",
                                "O"
                              ]
                            },
                            "voltage_range": {
                              "type": "object",
                              "properties": {
                                "min": {
                                  "type": "integer"
                                },
                                "max": {
                                  "type": "integer"
                                }
                              },
                              "required": [
                                "min",
                                "max"
                              ],
                              "description": "Rated voltage range, in volts"
                            },
                            "frequency_hz": {
                              "type": "array",
                              "items": {
                                "type": "integer"
                              }
                            },
                            "radio": {
                              "type": "boolean"
                            },
                            "mains_powered": {
                              "type": "boolean"
                            },
                            "battery_chemistry": {
                              "type": "string",
                              "enum": [
                                "none",
                                "lithium_ion",
                                "lithium_metal",
                                "nickel_metal_hydride",
                                "nickel_cadmium",
                                "alkaline",
                                "lead_acid",
                                "zinc_carbon",
                                "silver_oxide",
                                "other"
                              ]
                            },
                            "age_grade": {
                              "type": "object",
                              "properties": {
                                "min_months": {
                                  "type": "integer"
                                },
                                "max_months": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ],
                                  "description": "null: open-ended"
                                }
                              },
                              "required": [
                                "min_months",
                                "max_months"
                              ],
                              "description": "The ages the product is for, in months"
                            },
                            "contains_seal_products": {
                              "type": "boolean"
                            },
                            "contains_cat_dog_fur": {
                              "type": "boolean"
                            },
                            "contains_cites_species": {
                              "type": "boolean"
                            },
                            "is_torture_repression_goods": {
                              "type": "boolean"
                            },
                            "is_waste": {
                              "type": "boolean"
                            },
                            "contains_ivory": {
                              "type": "boolean"
                            },
                            "organic": {
                              "type": "boolean"
                            },
                            "commodity_code_gb": {
                              "type": "string"
                            },
                            "commodity_code_eu": {
                              "type": "string"
                            }
                          },
                          "description": "The attributes you stated, as read"
                        }
                      },
                      "required": [
                        "commodity_code",
                        "origins",
                        "destination",
                        "as_of",
                        "attributes"
                      ],
                      "description": "What was checked"
                    },
                    "verdict": {
                      "type": "string",
                      "enum": [
                        "blocked",
                        "conditional",
                        "clear",
                        "unknown"
                      ]
                    },
                    "scope": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "import_measures",
                          "conformity",
                          "technical_fit"
                        ]
                      },
                      "description": "The dimensions the answer is complete for. A clear verdict says nothing beyond them"
                    },
                    "unknown_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "commodity_code_not_found",
                          "commodity_code_too_general",
                          "destination_code_mismatch",
                          "destination_code_not_found",
                          "intra_eu_movement",
                          "invalid_commodity_code",
                          "invalid_destination",
                          "invalid_rule_conditions",
                          "lookup_failed",
                          "no_commodity_code",
                          "no_origin",
                          "not_covered",
                          "rule_needs_attributes",
                          "rule_needs_review",
                          "stale_rule_set",
                          "unreviewed_rule_set",
                          "unsupported_destination"
                        ]
                      },
                      "description": "Every unknown found; never empty when the verdict is unknown"
                    },
                    "reasons": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ComplianceReason"
                      }
                    },
                    "rule_ids": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "uuid"
                      }
                    },
                    "rule_set_version": {
                      "type": "string",
                      "description": "An opaque version of what the verdict was computed from. Compare it for equality: it changes when the rules or the tariff reads behind the verdict change"
                    },
                    "computed_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "disclaimer": {
                      "type": "string",
                      "description": "A fixed sentence: not legal advice, and what a clear verdict does and does not cover"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "check",
                    "verdict",
                    "scope",
                    "unknown_codes",
                    "reasons",
                    "rule_ids",
                    "rule_set_version",
                    "computed_at",
                    "disclaimer",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "4751a932-cfb9-4412-b7c4-727df802a767",
                  "check": {
                    "commodity_code": "610910",
                    "origins": [
                      "CN"
                    ],
                    "destination": "GB",
                    "as_of": "2026-11-21",
                    "attributes": {
                      "contains_cites_species": false
                    }
                  },
                  "verdict": "clear",
                  "scope": [
                    "import_measures"
                  ],
                  "unknown_codes": [],
                  "reasons": [
                    {
                      "kind": "checked",
                      "authority": "UK tariff",
                      "origin": "CN",
                      "resolved_code": "610910",
                      "source_url": "https://www.trade-tariff.service.gov.uk/headings/6109?day=21&month=11&year=2026",
                      "as_of": "2026-11-21",
                      "subheading": "610910",
                      "lines": [
                        "6109100010"
                      ],
                      "code_basis": {
                        "code": "610910",
                        "source": "item"
                      }
                    }
                  ],
                  "rule_ids": [],
                  "rule_set_version": "v-99585349118391b6",
                  "computed_at": "2026-11-21T10:55:52.623Z",
                  "disclaimer": "Not legal advice. A verdict reports the rules and official measures on file for the date shown, with their sources. A clear verdict cover..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "product_compliance",
        "x-writes": false
      }
    },
    "/v1/compliance/verdicts": {
      "get": {
        "operationId": "listComplianceVerdicts",
        "summary": "Your stored admissibility verdicts, by country then item, with scope and reasons. Each carries unknown_causes: coverage (we hold no rules for the country or chapter) or item_data (the item's data can fix it), review, source",
        "description": "Key scope: read (or execute). Module: product_compliance. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "compliance"
        ],
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "ISO 3166-1 alpha-2 country code (UK is read as GB; an EU member state, not EU)"
          },
          {
            "name": "verdict",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "blocked",
                "conditional",
                "clear",
                "unknown"
              ]
            }
          },
          {
            "name": "unknown_cause",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "coverage",
                "item_data",
                "review",
                "source"
              ]
            },
            "description": "Only verdicts with an unknown of this cause: coverage (no rule set or no coverage for the country and chapter; nothing in your data changes it), item_data (code, origin, attributes), review (a person must judge a fact), source (an official tariff could not be read)"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "The item's external id"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Search: part of the item's external id or description: letters, digits, spaces, . _ - / (not with item)"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Deprecated: use q",
            "deprecated": true
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ComplianceVerdict"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "verdict": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "blocked",
                            "conditional",
                            "clear",
                            "unknown",
                            null
                          ]
                        },
                        "unknown_cause": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "coverage",
                            "item_data",
                            "review",
                            "source",
                            null
                          ]
                        },
                        "item": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "search": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "country",
                        "verdict",
                        "unknown_cause",
                        "item",
                        "search"
                      ],
                      "description": "The filters the request applied"
                    },
                    "disclaimer": {
                      "type": "string",
                      "description": "A fixed sentence: not legal advice, and what a clear verdict does and does not cover"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "disclaimer",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "af781bdd-1cee-494e-900c-80068c3200a9",
                  "filters": {
                    "country": null,
                    "verdict": null,
                    "unknown_cause": null,
                    "item": null,
                    "search": null
                  },
                  "data": [
                    {
                      "item": {
                        "id": "3fa708bf-2388-47df-8cfa-7e975c1a28a8",
                        "external_id": "MAT-00000412",
                        "description": "Travel adapter, 4 plug types"
                      },
                      "country": "AE",
                      "computed": true,
                      "verdict": "unknown",
                      "scope": [],
                      "unknown_codes": [
                        "not_covered"
                      ],
                      "reasons": [
                        {
                          "fix": "Treat as not checked: nothing in the item's data changes it. Any rule that does match is still listed.",
                          "code": "not_covered",
                          "kind": "unknown",
                          "detail": "AE: chapter 85 is not fully covered for import prohibitions and licences.",
                          "message": "Rules are on file for the destination, but the item's chapter is not fully covered for import prohibitions and licences, so the answer..."
                        }
                      ],
                      "unknown_causes": [
                        "coverage"
                      ],
                      "rule_ids": [],
                      "rule_set_version": "v-f1aa266ecc247025",
                      "commodity_code": "853669",
                      "origins": [],
                      "computed_at": "2026-11-21T09:47:49.614+00:00",
                      "stale": false,
                      "stale_reasons": []
                    }
                  ],
                  "has_more": true,
                  "next_cursor": "example-token",
                  "disclaimer": "Not legal advice. A verdict reports the rules and official measures on file for the date shown, with their sources. A clear verdict cover...",
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "product_compliance",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/connections": {
      "get": {
        "operationId": "listConnections",
        "summary": "Connections with last sync, entity state and any running sync",
        "description": "Key scope: read (or execute). Module: connectors. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `connections`, deprecated.",
        "tags": [
          "connections"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ErpConnection"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "connections": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ErpConnection"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "connections",
                    "next_offset",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "8e9a87ab-8d08-4fcc-81e4-39b105b9200b",
                  "connections": [
                    {
                      "id": "94af960b-f577-4735-9922-8f956bf82e3f",
                      "name": "erp-main",
                      "system_type": "sensing",
                      "ingest_mode": "push",
                      "status": "active",
                      "pull_enabled": false,
                      "schedule_minutes": 1440,
                      "last_sync_at": null,
                      "last_sync_status": null,
                      "last_sync_message": null,
                      "last_ingest_at": "2026-11-21T09:32:41.268+00:00",
                      "last_ingest_status": "success",
                      "access_mode": "read_only",
                      "created_at": "2026-11-21T09:18:06.801587+00:00",
                      "updated_at": "2026-11-21T09:32:41.268393+00:00",
                      "writeback_enabled": false,
                      "entities": [],
                      "latest_sync_run": {
                        "id": "9a729324-3da8-471c-ad3c-beaa96bb65f2",
                        "status": "success",
                        "started_at": "2026-11-21T09:32:41.262272+00:00",
                        "finished_at": "2026-11-21T09:32:41.266+00:00",
                        "error_count": 0
                      },
                      "active_run": null
                    }
                  ],
                  "has_more": false,
                  "next_offset": null,
                  "object": "list",
                  "data": [
                    {
                      "id": "94af960b-f577-4735-9922-8f956bf82e3f",
                      "name": "erp-main",
                      "system_type": "sensing",
                      "ingest_mode": "push",
                      "status": "active",
                      "pull_enabled": false,
                      "schedule_minutes": 1440,
                      "last_sync_at": null,
                      "last_sync_status": null,
                      "last_sync_message": null,
                      "last_ingest_at": "2026-11-21T09:32:41.268+00:00",
                      "last_ingest_status": "success",
                      "access_mode": "read_only",
                      "created_at": "2026-11-21T09:18:06.801587+00:00",
                      "updated_at": "2026-11-21T09:32:41.268393+00:00",
                      "writeback_enabled": false,
                      "entities": [],
                      "latest_sync_run": {
                        "id": "9a729324-3da8-471c-ad3c-beaa96bb65f2",
                        "status": "success",
                        "started_at": "2026-11-21T09:32:41.262272+00:00",
                        "finished_at": "2026-11-21T09:32:41.266+00:00",
                        "error_count": 0
                      },
                      "active_run": null
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "connectors",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "connections"
        }
      }
    },
    "/v1/connections/{id}": {
      "get": {
        "operationId": "getConnection",
        "summary": "One connection",
        "description": "Key scope: read (or execute). Module: connectors.",
        "tags": [
          "connections"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connection": {
                      "$ref": "#/components/schemas/ErpConnection"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "connection",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "c7dfc6a7-2021-4d62-8978-26a50eb4d529",
                  "connection": {
                    "id": "94af960b-f577-4735-9922-8f956bf82e3f",
                    "name": "erp-main",
                    "system_type": "sensing",
                    "ingest_mode": "push",
                    "status": "active",
                    "pull_enabled": false,
                    "schedule_minutes": 1440,
                    "last_sync_at": null,
                    "last_sync_status": null,
                    "last_sync_message": null,
                    "last_ingest_at": "2026-11-21T09:32:41.268+00:00",
                    "last_ingest_status": "success",
                    "created_at": "2026-11-21T09:18:06.801587+00:00",
                    "updated_at": "2026-11-21T09:32:41.268393+00:00",
                    "access_mode": "read_only",
                    "writeback_enabled": false,
                    "entities": [],
                    "latest_sync_run": {
                      "id": "9a729324-3da8-471c-ad3c-beaa96bb65f2",
                      "status": "success",
                      "started_at": "2026-11-21T09:32:41.262272+00:00",
                      "finished_at": "2026-11-21T09:32:41.266+00:00",
                      "error_count": 0
                    },
                    "active_run": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "connectors",
        "x-writes": false
      }
    },
    "/v1/connections/{id}/sync": {
      "post": {
        "operationId": "syncConnection",
        "summary": "Start a sync now (4 per connection per hour; 409 while one runs, and when the connection is disconnected or has no scheduled pull; 202 when it is still running after 60 s: read GET /v1/sync_runs for how it ends)",
        "description": "Key scope: execute. Module: connectors. The key's creator must be an organization admin now. One sync reads a bounded number of rows per entity: `sync.truncated_entities` names the entities it cut, and the next sync resumes them",
        "tags": [
          "connections"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connection_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sync": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "description": "success, partial or failed: the sync finished (failed: no record stored). error: the sync broke off, see `error`. continued or started (202): still running. unknown: it ended without saying how"
                        },
                        "run_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid",
                          "description": "The id of this sync, the same as active_run.run_id on the connection while it runs; null when it is not known yet. It is not the id of a row of GET /v1/sync_runs"
                        },
                        "fetched": {
                          "type": "integer",
                          "description": "Records read so far"
                        },
                        "upserted": {
                          "type": "integer",
                          "description": "Records stored so far"
                        },
                        "truncated_entities": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Entities cut at the row cap of one sync; the next sync resumes them"
                        },
                        "reason": {
                          "type": "string",
                          "description": "With continued: why the answer came before the end"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "With error: what broke"
                        }
                      },
                      "required": [
                        "status",
                        "run_id",
                        "fetched",
                        "upserted"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "description": "Only when the sync was still running after the wait: how to follow it"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "connection_id",
                    "sync",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "58c65e00-4e7d-4816-8a25-9cf439d3b26d",
                  "connection_id": "c44d3092-5463-4708-8f2d-66d84fae0e0a",
                  "sync": {
                    "status": "success",
                    "run_id": "656c381a-5dc0-409c-af37-3d05050d7219",
                    "fetched": 0,
                    "upserted": 0
                  }
                }
              }
            }
          },
          "202": {
            "description": "The sync is still running (continued in the background, or not finished after the wait). GET /v1/connections/{id} shows it under active_run until it ends; GET /v1/sync_runs lists what it brought in",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connection_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sync": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "description": "success, partial or failed: the sync finished (failed: no record stored). error: the sync broke off, see `error`. continued or started (202): still running. unknown: it ended without saying how"
                        },
                        "run_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid",
                          "description": "The id of this sync, the same as active_run.run_id on the connection while it runs; null when it is not known yet. It is not the id of a row of GET /v1/sync_runs"
                        },
                        "fetched": {
                          "type": "integer",
                          "description": "Records read so far"
                        },
                        "upserted": {
                          "type": "integer",
                          "description": "Records stored so far"
                        },
                        "truncated_entities": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Entities cut at the row cap of one sync; the next sync resumes them"
                        },
                        "reason": {
                          "type": "string",
                          "description": "With continued: why the answer came before the end"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "With error: what broke"
                        }
                      },
                      "required": [
                        "status",
                        "run_id",
                        "fetched",
                        "upserted"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "description": "Only when the sync was still running after the wait: how to follow it"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "connection_id",
                    "sync",
                    "request_id"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "connectors",
        "x-writes": true
      }
    },
    "/v1/customs_documents": {
      "post": {
        "operationId": "createCustomsDocument",
        "summary": "A commercial invoice, packing list or both, computed from the shipment you send. Logs the document",
        "description": "Key scope: read (or execute). Module: customs_docs.",
        "tags": [
          "customs_documents"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "document_type": {
                    "type": "string",
                    "enum": [
                      "commercial_invoice",
                      "packing_list",
                      "combined"
                    ],
                    "default": "commercial_invoice"
                  },
                  "shipper": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string",
                        "pattern": "^[A-Za-z]{2}$",
                        "description": "ISO 3166-1 alpha-2 country code"
                      },
                      "address_line1": {
                        "type": "string"
                      },
                      "address_line2": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "state": {
                        "type": "string"
                      },
                      "postal_code": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      },
                      "tax_id": {
                        "type": "string",
                        "description": "Tax or registration number, e.g. an EORI or VAT number"
                      }
                    },
                    "required": [
                      "name",
                      "country"
                    ],
                    "additionalProperties": true
                  },
                  "consignee": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string",
                        "pattern": "^[A-Za-z]{2}$",
                        "description": "ISO 3166-1 alpha-2 country code"
                      },
                      "address_line1": {
                        "type": "string"
                      },
                      "address_line2": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "state": {
                        "type": "string"
                      },
                      "postal_code": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      },
                      "tax_id": {
                        "type": "string",
                        "description": "Tax or registration number, e.g. an EORI or VAT number"
                      }
                    },
                    "required": [
                      "name",
                      "country"
                    ],
                    "additionalProperties": true
                  },
                  "line_items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "hs_code": {
                          "type": "string",
                          "maxLength": 20
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000000,
                          "default": 1
                        },
                        "unit": {
                          "type": "string",
                          "maxLength": 16,
                          "description": "The unit the quantity counts (KG, EA, BAG, ...)"
                        },
                        "unit_value": {
                          "type": "number",
                          "minimum": 0,
                          "description": "Value of one unit, in currency",
                          "default": 0
                        },
                        "weight_kg": {
                          "type": "number",
                          "minimum": 0,
                          "description": "Net weight of one unit, kg"
                        },
                        "country_of_origin": {
                          "type": "string",
                          "pattern": "^[A-Za-z]{2}$",
                          "description": "ISO 3166-1 alpha-2 country code (default: the shipper's country)"
                        },
                        "package_count": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000000,
                          "description": "How many packages the line is packed in. Not stated, the packing list shows none (it is never guessed)"
                        },
                        "package_type": {
                          "type": "string",
                          "maxLength": 40,
                          "description": "The kind of package: bag, carton, pallet, ..."
                        },
                        "marks": {
                          "type": "string",
                          "maxLength": 200,
                          "description": "Shipping marks and numbers on the packages"
                        }
                      },
                      "required": [
                        "description"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1
                  },
                  "currency": {
                    "type": "string",
                    "maxLength": 8,
                    "description": "Currency code",
                    "default": "USD"
                  },
                  "incoterm": {
                    "type": "string",
                    "maxLength": 8,
                    "description": "Incoterms rule",
                    "default": "FOB"
                  },
                  "freight_cost": {
                    "type": "number",
                    "minimum": 0
                  },
                  "insurance_cost": {
                    "type": "number",
                    "minimum": 0
                  },
                  "invoice_number": {
                    "type": "string"
                  },
                  "invoice_date": {
                    "type": "string",
                    "format": "date"
                  },
                  "po_number": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "transport_mode": {
                    "type": "string"
                  },
                  "vessel_flight": {
                    "type": "string"
                  },
                  "port_of_loading": {
                    "type": "string"
                  },
                  "port_of_discharge": {
                    "type": "string"
                  }
                },
                "required": [
                  "shipper",
                  "consignee",
                  "line_items"
                ],
                "additionalProperties": true
              },
              "example": {
                "document_type": "commercial_invoice",
                "shipper": {
                  "name": "Northwind Textiles Ltd",
                  "address_line1": "14 Canal Road",
                  "city": "Hai Phong",
                  "country": "VN"
                },
                "consignee": {
                  "name": "Harbor Outfitters Inc",
                  "address_line1": "200 Dock Street",
                  "city": "Portland",
                  "state": "OR",
                  "postal_code": "97201",
                  "country": "US"
                },
                "line_items": [
                  {
                    "description": "Cotton T-shirt, knitted",
                    "hs_code": "6109.10",
                    "quantity": 1000,
                    "unit_value": 12.5,
                    "weight_kg": 0.2,
                    "country_of_origin": "VN"
                  }
                ],
                "currency": "USD",
                "incoterm": "FOB",
                "freight_cost": 850,
                "insurance_cost": 60,
                "invoice_number": "INV-2041",
                "invoice_date": "2026-12-01",
                "po_number": "PO-7781"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "document": {
                      "$ref": "#/components/schemas/CustomsDocument"
                    },
                    "duration_ms": {
                      "type": "integer"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "document",
                    "duration_ms",
                    "disclaimer",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "694b271b-4206-4cf1-81d5-f27d2c325344",
                  "document": {
                    "document_type": "combined",
                    "generated_at": "2026-11-21T10:55:53.576Z",
                    "invoice_number": "INV-20261121-694B27",
                    "invoice_date": "2026-11-21",
                    "po_number": "PO-CONTRACT-1",
                    "currency": "USD",
                    "incoterm": "FOB",
                    "shipper": {
                      "name": "Lakeside Exports Ltd",
                      "address_line1": "1 Harbour Road",
                      "address_line2": null,
                      "city": "Ho Chi Minh City",
                      "state": null,
                      "postal_code": null,
                      "country": "VN",
                      "phone": null,
                      "email": null,
                      "tax_id": null
                    },
                    "consignee": {
                      "name": "Harborview Imports Inc",
                      "address_line1": null,
                      "address_line2": null,
                      "city": "Newark",
                      "state": "NJ",
                      "postal_code": "07102",
                      "country": "US",
                      "phone": null,
                      "email": null,
                      "tax_id": "12-3456789"
                    },
                    "transport": {
                      "mode": "sea",
                      "vessel_flight": null,
                      "port_of_loading": "Cat Lai",
                      "port_of_discharge": "Newark"
                    },
                    "line_items": [
                      {
                        "item_number": 1,
                        "description": "Cotton T-shirts",
                        "hs_code": "6109.10",
                        "quantity": 500,
                        "unit": "EA",
                        "unit_value": 4.2,
                        "total_value": 2100,
                        "weight_kg": 0.18,
                        "net_weight_kg": 90,
                        "country_of_origin": "VN"
                      }
                    ],
                    "summary": {
                      "total_items": 2,
                      "total_quantity": 1000,
                      "subtotal": 2125,
                      "freight_cost": 350,
                      "insurance_cost": 25,
                      "total_invoice_value": 2500
                    },
                    "declarations": [
                      "I, the undersigned, hereby declare that the information contained in this invoice is true and correct and that the contents of this shipm..."
                    ],
                    "packing_details": [
                      {
                        "item_number": 1,
                        "description": "Cotton T-shirts",
                        "hs_code": "6109.10",
                        "quantity": 500,
                        "unit": "EA",
                        "weight_kg": 0.18,
                        "net_weight_kg": 90,
                        "package_count": 10,
                        "package_type": "carton",
                        "marks": "HV/NWK 1-10"
                      }
                    ],
                    "packing_summary": {
                      "total_packages": null,
                      "lines_without_packages": 1,
                      "total_quantity": 1000,
                      "total_net_weight_kg": 90,
                      "lines_without_weight": 1,
                      "total_weight_kg": 90
                    },
                    "notes": null
                  },
                  "duration_ms": 2,
                  "disclaimer": "A commercial invoice and packing list built from the data you entered, to hand to your customs broker or forwarder. It is not filed w..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "customs_docs",
        "x-writes": false
      }
    },
    "/v1/customs_documents/draft": {
      "get": {
        "operationId": "getCustomsDocumentDraft",
        "summary": "A draft commercial invoice and packing list from one of your purchase orders: the supplier as shipper, your organization at the receiving location as consignee, and a line per order line (item description, HS code, origin, quantity, unit, price, net weight). Edit it and send it to POST to build the document",
        "description": "Key scope: read (or execute). Module: customs_docs.",
        "tags": [
          "customs_documents"
        ],
        "parameters": [
          {
            "name": "purchase_order",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "The purchase order's number (its external id)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft": {
                      "$ref": "#/components/schemas/CustomsDocumentDraft"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "draft",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "0b7f3c2e-5a41-4d8e-9c6f-2d1e8a7b4c90",
                  "draft": {
                    "purchase_order": {
                      "external_id": "4500001234",
                      "status": "open",
                      "order_date": "2026-11-10",
                      "currency": "USD"
                    },
                    "shipper": {
                      "name": "Lakeside Exports Ltd",
                      "city": "Ho Chi Minh City",
                      "country": "VN"
                    },
                    "consignee": {
                      "name": "Harborview Imports Inc",
                      "city": "Newark",
                      "country": "US",
                      "location": "Newark DC"
                    },
                    "currency": "USD",
                    "po_number": "4500001234",
                    "line_items": [
                      {
                        "description": "Green coffee, washed arabica",
                        "item_code": "GC-100",
                        "hs_code": "0901.11.0015",
                        "country_of_origin": "VN",
                        "origin_basis": "item",
                        "quantity": 320,
                        "quantity_basis": "ordered",
                        "unit": "BAG",
                        "unit_value": 410,
                        "weight_kg": 60
                      }
                    ],
                    "missing": [
                      "Add the packages (count and kind) for each line: an order does not say how the goods are packed."
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "customs_docs",
        "x-writes": false
      }
    },
    "/v1/denied_party_screenings": {
      "post": {
        "operationId": "createDeniedPartyScreening",
        "summary": "Screen a person or company against the consolidated denied-party lists: CLEAR, REVIEW or BLOCK with the matches. One of company_name, or first_name with last_name, is required. Stores the screening",
        "description": "Key scope: read (or execute). Module: screening. At most 25 candidates are scored, best first; only those scoring 0.5 or more are listed",
        "tags": [
          "denied_party_screenings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "first_name": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Required with last_name, unless company_name is sent"
                  },
                  "last_name": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Required with first_name, unless company_name is sent"
                  },
                  "company_name": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Required unless first_name and last_name are sent"
                  },
                  "country_code": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "ISO 3166-1 alpha-2 country code"
                  },
                  "locality": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "address_line1": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "firstName": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Deprecated: use first_name",
                    "deprecated": true
                  },
                  "lastName": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Deprecated: use last_name",
                    "deprecated": true
                  },
                  "companyName": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Deprecated: use company_name",
                    "deprecated": true
                  },
                  "addressLine1": {
                    "type": "string",
                    "maxLength": 300,
                    "description": "Deprecated: use address_line1",
                    "deprecated": true
                  },
                  "countryCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "Deprecated: use country_code",
                    "deprecated": true
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "company_name": "Northwind Textiles Ltd",
                "country_code": "VN",
                "locality": "Hai Phong"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeniedPartyScreening"
                },
                "example": {
                  "screening_id": "7a274fc4-848d-4282-a6ac-324451a2f969",
                  "request_id": "c55491a7-ea77-47b4-a3af-6b08b95d0c00",
                  "searched_party": {
                    "first_name": null,
                    "last_name": null,
                    "company_name": "Example Trading LLC",
                    "country_code": "AE"
                  },
                  "action": "BLOCK",
                  "match_count": 4,
                  "best_score": 1,
                  "matches": [
                    {
                      "denied_party": {
                        "id": "b65ce09b-6f28-41ea-ae91-35f972acd007",
                        "name": "EXAMPLE TRADING LLC",
                        "alt_names": [],
                        "entity_type": null,
                        "country": "AE",
                        "locality": "DUBAI",
                        "address_line1": "PO BOX 00000",
                        "source_list": "Denied Persons List (DPL) - Bureau of Industry and Security",
                        "source_list_code": "DPL",
                        "programs": [],
                        "federal_register_notice": "75 F.R. 56052 9/15/10, 76 F.R. 12318 3/7/11, 76 F.R. 54198 8/31/11, 77 F.R. 10719 2/23/12, 77 F.R. 48960 8/15/12, 78 F.R. 9359 2/8/13, 78...",
                        "start_date": "2014-08-13",
                        "end_date": "2016-08-13",
                        "remarks": "FEDERAL REGISTER UPDATED",
                        "source_url": "https://www.bis.gov/licensing/end-user-guidance/denied-persons-list-dpl"
                      },
                      "scores": {
                        "name_score": 1,
                        "name_match": "EXACT_MATCH",
                        "country_match": "EXACT_MATCH",
                        "overall_score": 1
                      }
                    }
                  ],
                  "ai_analysis": null,
                  "ai_opinion": null,
                  "duration_ms": 388,
                  "disclaimer": "This screening is provided for informational purposes only. It does not constitute legal advice. Users should consult with trade complian..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "screening",
        "x-writes": false
      }
    },
    "/v1/disruptions": {
      "get": {
        "operationId": "listDisruptions",
        "summary": "The 200 most severe active disruption events crossed with your suppliers, open POs and inventory, each with a 0-100 exposure score",
        "description": "Key scope: read (or execute). Module: disruptions. API key only (no session). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `events`, deprecated. Only the 200 most severe active events that pass the filters are ranked; an event beyond them is never listed. Per event, `affected_suppliers` holds the first 10 and `open_purchase_orders` and `items` the first 20.",
        "tags": [
          "disruptions"
        ],
        "parameters": [
          {
            "name": "min_severity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 1
            },
            "description": "Only events of this severity or higher: 1 (minor) to 5 (most severe)"
          },
          {
            "name": "signal_class",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "supply_risk",
                "demand_driver"
              ]
            },
            "description": "supply_risk: events that can interrupt supply; demand_driver: events that move demand"
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "Only events in this country (ISO 3166-1 alpha-2)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DisruptionEventExposure"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DisruptionEventExposure"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When your ERP data was last received; null when never"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "true when the ERP data is older than 24 hours or absent"
                    },
                    "erp_data_present": {
                      "type": "boolean"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "min_severity": {
                          "type": "integer"
                        },
                        "signal_class": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "supply_risk",
                            "demand_driver",
                            null
                          ]
                        },
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "limit": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "min_severity",
                        "signal_class",
                        "country",
                        "limit"
                      ],
                      "description": "The filters as applied"
                    },
                    "event_count": {
                      "type": "integer",
                      "description": "Events on this page"
                    },
                    "duration_ms": {
                      "type": "integer"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "How to read the figures"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "events",
                    "data_as_of",
                    "stale",
                    "erp_data_present",
                    "filters",
                    "event_count",
                    "duration_ms",
                    "notes",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "017a26c7-113c-4ed1-a2bd-e72c44fadfc6",
                  "data_as_of": null,
                  "stale": true,
                  "erp_data_present": true,
                  "filters": {
                    "min_severity": 1,
                    "signal_class": null,
                    "country": null,
                    "limit": 100
                  },
                  "event_count": 100,
                  "has_more": true,
                  "events": [
                    {
                      "id": "0079d898-45a1-4193-9da9-bed3542686d7",
                      "signal_class": "supply_risk",
                      "event_type": "sps_notification",
                      "severity": 3,
                      "title": "European Union: Procedure to be followed to grant temporary derogations from import prohibitions or from special import requirements in p...",
                      "summary": "The proposal notified in G/SPS/N/EU/917 (10 February 2026) is now adopted by Commission Delegated Regulation (EU) 2026/1830 of 16 July 20...",
                      "country_codes": [
                        "AT"
                      ],
                      "starts_at": "2026-11-18T00:00:00+00:00",
                      "ends_at": "2027-02-16T00:00:00+00:00",
                      "exposure": {
                        "score": 72.5,
                        "affected_supplier_count": 25,
                        "affected_suppliers": [
                          {
                            "external_id": "VEND-000073",
                            "name": "Florence Hardware 0073",
                            "country_code": "IT"
                          }
                        ],
                        "value_at_risk": 528464.12,
                        "open_purchase_orders": [
                          {
                            "external_id": "PI-PO-00052",
                            "supplier_external_id": "VEND-000005",
                            "status": "open",
                            "currency": "USD",
                            "expected_delivery_date": "2026-11-13",
                            "value_at_risk": 9092.24
                          }
                        ],
                        "items": [
                          {
                            "external_id": "MAT-00000006",
                            "description": "Small Leather Goods - Style 00000006",
                            "quantity_on_hand": 10,
                            "days_of_cover": 0.4,
                            "single_sourced_in_affected_region": false
                          }
                        ]
                      }
                    }
                  ],
                  "duration_ms": 22,
                  "notes": [
                    "exposure.score is 0 to 100 and is the same for the same data: it rises with the event's severity, the value at risk, low days of cover and single sourcing. Zero means no detected exposure for your network."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "id": "0079d898-45a1-4193-9da9-bed3542686d7",
                      "signal_class": "supply_risk",
                      "event_type": "sps_notification",
                      "severity": 3,
                      "title": "European Union: Procedure to be followed to grant temporary derogations from import prohibitions or from special import requirements in p...",
                      "summary": "The proposal notified in G/SPS/N/EU/917 (10 February 2026) is now adopted by Commission Delegated Regulation (EU) 2026/1830 of 16 July 20...",
                      "country_codes": [
                        "AT"
                      ],
                      "starts_at": "2026-11-18T00:00:00+00:00",
                      "ends_at": "2027-02-16T00:00:00+00:00",
                      "exposure": {
                        "score": 72.5,
                        "affected_supplier_count": 25,
                        "affected_suppliers": [
                          {
                            "external_id": "VEND-000073",
                            "name": "Florence Hardware 0073",
                            "country_code": "IT"
                          }
                        ],
                        "value_at_risk": 528464.12,
                        "open_purchase_orders": [
                          {
                            "external_id": "PI-PO-00052",
                            "supplier_external_id": "VEND-000005",
                            "status": "open",
                            "currency": "USD",
                            "expected_delivery_date": "2026-11-13",
                            "value_at_risk": 9092.24
                          }
                        ],
                        "items": [
                          {
                            "external_id": "MAT-00000006",
                            "description": "Small Leather Goods - Style 00000006",
                            "quantity_on_hand": 10,
                            "days_of_cover": 0.4,
                            "single_sourced_in_affected_region": false
                          }
                        ]
                      }
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "disruptions",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "events"
        }
      }
    },
    "/v1/disruptions/event_exposure": {
      "get": {
        "operationId": "listDisruptionEventExposure",
        "summary": "Exposed events, ranked",
        "description": "Key scope: read (or execute). Module: disruptions. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "disruptions"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 7,
              "maximum": 365,
              "default": 90
            },
            "description": "Days of demand history the exposure is measured on"
          },
          {
            "name": "min_severity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 1
            },
            "description": "Only events of this severity or higher: 1 (minor) to 5 (most severe)"
          },
          {
            "name": "signal_class",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "supply_risk",
                "demand_driver"
              ]
            },
            "description": "supply_risk: events that can interrupt supply; demand_driver: events that move demand"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DisruptionRankedEvent"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "window_days": {
                          "type": "integer"
                        },
                        "min_severity": {
                          "type": "integer"
                        },
                        "signal_class": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "supply_risk",
                            "demand_driver",
                            null
                          ]
                        }
                      },
                      "required": [
                        "window_days",
                        "min_severity",
                        "signal_class"
                      ],
                      "description": "The filters as applied"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Exposed events matching the filters, over every page"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "How to read the figures"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "total",
                    "notes",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "87d23566-f3d3-4d3b-b805-21961d5a9a15",
                  "filters": {
                    "window_days": 90,
                    "min_severity": 1,
                    "signal_class": null
                  },
                  "total": 78,
                  "data": [
                    {
                      "id": "8ab2b736-3b7e-4148-88bc-f3ed16722e3c",
                      "signal_class": "demand_driver",
                      "event_type": "holiday_peak",
                      "severity": 2,
                      "title": "Valentine's Day run-up 2027",
                      "summary": "Gifting run-up to Valentine's Day; planning assumption 1.3x baseline demand, strongest in handbags and small leather goods.",
                      "country_codes": [
                        "US"
                      ],
                      "starts_at": "2027-02-07T00:00:00+00:00",
                      "ends_at": "2027-02-14T23:59:59+00:00",
                      "exposure": {
                        "score": 75.9,
                        "affected_supplier_count": 73,
                        "affected_suppliers": [
                          {
                            "external_id": "VEND-000191",
                            "name": "Bangkok Accessories Co. 0191",
                            "country_code": "IT"
                          }
                        ],
                        "value_at_risk": 1497973.08,
                        "open_po_count": 15,
                        "items": [
                          {
                            "external_id": "MAT-00000003",
                            "description": "Accessories - Style 00000003",
                            "quantity_on_hand": 9,
                            "demand_qty": 1123,
                            "days_of_cover": 0.7,
                            "single_sourced": false
                          }
                        ]
                      }
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "notes": [
                    "Only active events that reach at least one of your suppliers are listed (by distance where the event has a point, else by country)."
                  ],
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "disruptions",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/disruptions/exposure_by_product": {
      "get": {
        "operationId": "listDisruptionExposureByProduct",
        "summary": "Exposure per item",
        "description": "Key scope: read (or execute). Module: disruptions. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "disruptions"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 7,
              "maximum": 365,
              "default": 90
            },
            "description": "Days of demand history the exposure is measured on"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DisruptionProductExposure"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "window_days": {
                          "type": "integer"
                        },
                        "item": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The item external id asked for"
                        }
                      },
                      "required": [
                        "window_days",
                        "item"
                      ],
                      "description": "The filters as applied"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Exposed items matching the filters, over every page"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "total",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "daa1a691-4f5f-4e27-bdaf-f69d450ca1a7",
                  "filters": {
                    "window_days": 90,
                    "item": null
                  },
                  "total": 27,
                  "data": [
                    {
                      "item_id": "cc7b6a7f-785d-4c16-ac76-e76ea513b425",
                      "external_id": "MAT-00000557",
                      "description": "Accessories - Style 00000557",
                      "on_hand": 126,
                      "demand_qty": 17,
                      "single_sourced": false,
                      "events": [
                        {
                          "id": "74e5a673-7b85-4cb6-8ea0-0209ea801116",
                          "title": "Chinese New Year factory shutdown 2027",
                          "event_type": "factory_shutdown",
                          "severity": 4,
                          "signal_class": "supply_risk"
                        }
                      ],
                      "max_severity": 4,
                      "event_count": 24
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "disruptions",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/disruptions/exposure_totals": {
      "get": {
        "operationId": "getDisruptionExposureTotals",
        "summary": "Events affecting you, suppliers, countries, open POs and value at risk",
        "description": "Key scope: read (or execute). Module: disruptions.",
        "tags": [
          "disruptions"
        ],
        "parameters": [
          {
            "name": "supply_risk_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "false also counts demand drivers"
          },
          {
            "name": "min_severity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 3
            },
            "description": "Only events of this severity or higher: 1 (minor) to 5 (most severe)"
          },
          {
            "name": "horizon_days",
            "in": "query",
            "required": false,
            "schema": {
              "oneOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 366,
                  "default": 14
                },
                {
                  "type": "string",
                  "enum": [
                    "any"
                  ]
                }
              ]
            },
            "description": "Only events under way or starting within this many days, 0 to 366 (default 14); any: no limit"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "filters": {
                      "type": "object",
                      "properties": {
                        "supply_risk_only": {
                          "type": "boolean"
                        },
                        "min_severity": {
                          "type": "integer"
                        },
                        "horizon_days": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Events starting within this many days; null for any start"
                        }
                      },
                      "required": [
                        "supply_risk_only",
                        "min_severity",
                        "horizon_days"
                      ],
                      "description": "The filters as applied"
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "events_affecting": {
                          "type": "integer",
                          "description": "Active events that reach at least one of your suppliers"
                        },
                        "suppliers": {
                          "type": "integer",
                          "description": "Your suppliers those events reach"
                        },
                        "countries": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "ISO 3166-1 alpha-2 country code"
                          },
                          "description": "The countries of those suppliers"
                        },
                        "open_pos": {
                          "type": "integer",
                          "description": "Open purchase orders with those suppliers"
                        },
                        "value_at_risk": {
                          "type": "number",
                          "description": "Value still open on those orders, each in its own currency (not converted)"
                        }
                      },
                      "required": [
                        "events_affecting",
                        "suppliers",
                        "countries",
                        "open_pos",
                        "value_at_risk"
                      ]
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "How to read the figures"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "filters",
                    "totals",
                    "notes",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "39a56520-b197-4ba9-91d0-cb3ed68b1b98",
                  "filters": {
                    "supply_risk_only": true,
                    "min_severity": 3,
                    "horizon_days": 14
                  },
                  "totals": {
                    "events_affecting": 11,
                    "suppliers": 96,
                    "countries": [
                      "CN"
                    ],
                    "open_pos": 13,
                    "value_at_risk": 1428013.46
                  },
                  "notes": [
                    "The defaults count supply risk only (supply_risk_only=true, min_severity=3, horizon_days=14); for every event that reaches you send supply_risk_only=false, min_severity=1, horizon_days=any."
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "disruptions",
        "x-writes": false
      }
    },
    "/v1/explanations": {
      "post": {
        "operationId": "createExplanation",
        "summary": "The computed evidence behind a recommendation and a narrative (from a template, or written with AI when use_ai is set)",
        "description": "Key scope: read (or execute). Module: recommendations.",
        "tags": [
          "explanations"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recommendation_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The recommendation id"
                  },
                  "use_ai": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "required": [
                  "recommendation_id"
                ],
                "additionalProperties": false
              },
              "example": {
                "recommendation_id": "5b8f6c1e-2d47-4a9b-8e21-7c6d5f4a3b2e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "X-Model-Budget-Limit": {
                "$ref": "#/components/headers/X-Model-Budget-Limit"
              },
              "X-Model-Budget-Remaining": {
                "$ref": "#/components/headers/X-Model-Budget-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "evidence": {
                      "$ref": "#/components/schemas/RecommendationEvidence"
                    },
                    "narrative": {
                      "type": "string",
                      "description": "The evidence in two or three sentences"
                    },
                    "narrative_source": {
                      "type": "string",
                      "enum": [
                        "template",
                        "ai"
                      ],
                      "description": "template: written from the evidence by rule. ai: written with AI from the same evidence (only with use_ai, and only when AI is available; otherwise template)"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "evidence",
                    "narrative",
                    "narrative_source",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "29170164-9698-4e98-9958-2b9d05752387",
                  "evidence": {
                    "headline": "Purchase 7 Small Leather Goods - Style 00000028 from Bangkok Footwear Mfg 0107",
                    "drivers": [
                      {
                        "label": "Compliance check",
                        "value": "Flagged · No verdict is stored for this item in CA yet."
                      }
                    ],
                    "cost_benefit": [],
                    "confidence": "High",
                    "confidence_reason": "priority score 100",
                    "lineage": [
                      {
                        "label": "Data as of",
                        "value": "unknown"
                      }
                    ]
                  },
                  "narrative": "Purchase 7 Small Leather Goods - Style 00000028 from Bangkok Footwear Mfg 0107. Why: compliance check Flagged · No verdict is stored for ...",
                  "narrative_source": "template"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "recommendations",
        "x-writes": false
      }
    },
    "/v1/forecast_checks": {
      "post": {
        "operationId": "createForecastCheck",
        "summary": "Check your own forecast rows against our baseline for the same period, with the signals in that window and a verdict per row. One of rows or stored is required, never both: send rows, or stored: one week of a plan version we hold (its id is shown in the app; needs the demand_planning module), paged by after. The body is at most 256 KB (413 above)",
        "description": "Key scope: read (or execute).",
        "tags": [
          "forecast_checks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "stored": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "string",
                        "format": "uuid",
                        "description": "A plan version id, as the app shows it"
                      },
                      "week_start": {
                        "type": "string",
                        "format": "date",
                        "description": "The Monday of the week to check; today or later"
                      },
                      "limit": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 500,
                        "default": 500,
                        "description": "Item-location pairs"
                      },
                      "after": {
                        "type": "object",
                        "properties": {
                          "item_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "location_id": {
                            "type": "string",
                            "format": "uuid"
                          }
                        },
                        "required": [
                          "item_id",
                          "location_id"
                        ],
                        "additionalProperties": false,
                        "description": "The `next` of the previous response"
                      }
                    },
                    "required": [
                      "version",
                      "week_start"
                    ],
                    "additionalProperties": false,
                    "description": "Instead of rows, not with them"
                  },
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "item": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "description": "The item's external id"
                        },
                        "location": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "description": "The location's external id"
                        },
                        "period_start": {
                          "type": "string",
                          "format": "date",
                          "description": "Today (UTC) or later"
                        },
                        "period_days": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 90
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000000,
                          "description": "Your forecast for the whole period"
                        },
                        "ref": {
                          "type": [
                            "string",
                            "number"
                          ],
                          "maxLength": 128,
                          "description": "Echoed back"
                        }
                      },
                      "required": [
                        "item",
                        "location",
                        "period_start",
                        "period_days",
                        "quantity"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 500
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "window_days": {
                        "type": "integer",
                        "minimum": 30,
                        "maximum": 365,
                        "default": 90
                      },
                      "tolerance_pct": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100,
                        "default": 15
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false,
                "oneOf": [
                  {
                    "required": [
                      "rows"
                    ]
                  },
                  {
                    "required": [
                      "stored"
                    ]
                  }
                ]
              },
              "example": {
                "rows": [
                  {
                    "item": "SKU-100",
                    "location": "STORE-12",
                    "period_start": "2026-12-07",
                    "period_days": 7,
                    "quantity": 140,
                    "ref": "row-1"
                  },
                  {
                    "item": "SKU-100",
                    "location": "STORE-14",
                    "period_start": "2026-12-07",
                    "period_days": 7,
                    "quantity": 95,
                    "ref": "row-2"
                  }
                ],
                "options": {
                  "window_days": 90,
                  "tolerance_pct": 15
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "stored": {
                      "type": "object",
                      "properties": {
                        "version": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "kind": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "source": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "kind",
                            "name",
                            "source"
                          ]
                        },
                        "week_start": {
                          "type": "string",
                          "format": "date"
                        },
                        "count": {
                          "type": "integer",
                          "description": "Item-location pairs checked in this response"
                        },
                        "next": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "item_id": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "location_id": {
                              "type": "string",
                              "format": "uuid"
                            }
                          },
                          "required": [
                            "item_id",
                            "location_id"
                          ],
                          "description": "Send as stored.after to check the pairs after these; null when these were the last"
                        }
                      },
                      "required": [
                        "version",
                        "week_start",
                        "count",
                        "next"
                      ],
                      "description": "Present when the request named a stored forecast instead of rows"
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date",
                      "description": "Today (UTC)"
                    },
                    "options": {
                      "type": "object",
                      "properties": {
                        "window_days": {
                          "type": "integer"
                        },
                        "tolerance_pct": {
                          "type": "number"
                        },
                        "horizon_days": {
                          "type": "integer",
                          "description": "A period must end within this many days of today"
                        },
                        "min_demand_days": {
                          "type": "integer",
                          "description": "Days with demand a baseline needs in the window"
                        },
                        "max_band_pct": {
                          "type": "integer",
                          "description": "The widest agreement band, in percent"
                        }
                      },
                      "required": [
                        "window_days",
                        "tolerance_pct",
                        "horizon_days",
                        "min_demand_days",
                        "max_band_pct"
                      ],
                      "description": "The options as used"
                    },
                    "history_window": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string",
                          "format": "date"
                        },
                        "to": {
                          "type": "string",
                          "format": "date"
                        }
                      },
                      "required": [
                        "from",
                        "to"
                      ]
                    },
                    "signals_adjust_baseline": {
                      "const": false,
                      "description": "Signals are evidence only; they never change the baseline"
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "agree": {
                          "type": "integer"
                        },
                        "above": {
                          "type": "integer"
                        },
                        "below": {
                          "type": "integer"
                        },
                        "no_baseline": {
                          "type": "integer"
                        },
                        "error": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "agree",
                        "above",
                        "below",
                        "no_baseline",
                        "error"
                      ]
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/ForecastCheckRow"
                          },
                          {
                            "$ref": "#/components/schemas/ForecastCheckRowError"
                          }
                        ]
                      },
                      "description": "One per row of the request, in its order; `status` says which shape a row has"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource",
                      "description": "Present when at least one row resolved"
                    },
                    "duration_ms": {
                      "type": "integer"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "as_of",
                    "options",
                    "history_window",
                    "signals_adjust_baseline",
                    "counts",
                    "rows",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "e32a78d5-2b7f-400d-aab0-a5eef299fffe",
                  "as_of": "2026-11-21",
                  "options": {
                    "window_days": 90,
                    "tolerance_pct": 15,
                    "horizon_days": 90,
                    "min_demand_days": 4,
                    "max_band_pct": 100
                  },
                  "history_window": {
                    "from": "2026-08-23",
                    "to": "2026-11-20"
                  },
                  "signals_adjust_baseline": false,
                  "counts": {
                    "agree": 2,
                    "above": 0,
                    "below": 0,
                    "no_baseline": 0,
                    "error": 1
                  },
                  "rows": [
                    {
                      "index": 0,
                      "ref": "row-1",
                      "item": "MAT-00000028",
                      "location": "1005",
                      "period": {
                        "start": "2026-11-28",
                        "end": "2026-12-04",
                        "days": 7
                      },
                      "quantity": 40,
                      "status": "ok",
                      "history": {
                        "window_days": 90,
                        "from": "2026-08-23",
                        "to": "2026-11-20",
                        "demand_days": 11,
                        "total_quantity": 1090,
                        "mean_daily": 12.1111,
                        "classification": "lumpy"
                      },
                      "baseline": {
                        "quantity": 67.69,
                        "daily_rate": 9.67,
                        "method": "smoothed_weekday",
                        "classification": "lumpy",
                        "in_sample_mae": null,
                        "period_offset_days": 7
                      },
                      "baseline_reason": null,
                      "difference": {
                        "absolute": -27.69,
                        "percent": -40.9,
                        "band": {
                          "pct": 100,
                          "tolerance_pct": 15,
                          "noise_pct": 180.7,
                          "noise_basis": "daily_std_dev",
                          "noise_daily": 46.2276,
                          "capped": true,
                          "rule": "agree when |percent| <= min(100, max(tolerance_pct, noise_pct)); noise_pct = 100 * noise_daily * sqrt(period_days) / baseline"
                        },
                        "verdict": "agree"
                      },
                      "signals": {
                        "trend": {
                          "rising": true,
                          "fading": false,
                          "signals": [
                            {
                              "id": "efeb189e-a05a-44a6-8bd3-efbeab4b7f54",
                              "detector": "event_window",
                              "direction": "rising",
                              "headline": "Black Friday / Cyber week is 6 days out: 34 of 90 fitting styles will sell through before it and supplier lead times are already longer t...",
                              "severity": "medium"
                            }
                          ],
                          "source": "trends"
                        },
                        "demand_drivers": {
                          "count": 1,
                          "events": [
                            {
                              "id": "06838e82-72da-4ac5-87d6-c110098dd2bd",
                              "source": "disruptions",
                              "title": "Western holiday retail peak 2026",
                              "event_type": "holiday_peak",
                              "severity": 3,
                              "starts_at": "2026-11-27T00:00:00+00:00",
                              "ends_at": "2026-12-31T23:59:59+00:00",
                              "match": "country",
                              "distance_km": null
                            }
                          ]
                        },
                        "calendar": {
                          "count": 0,
                          "holidays": [],
                          "org_events": []
                        },
                        "supply": {
                          "disrupted": false,
                          "countries": [],
                          "events": [],
                          "source": "disruptions"
                        }
                      },
                      "flags": [
                        "demand_driver_in_period"
                      ]
                    }
                  ],
                  "notes": [
                    "Baseline: a statistical forecast from daily demand over the history window, the same for the same history (smoothed by weekday for steady and variable demand, an intermittent-demand method for sparse demand). demand_source says which demand history was read."
                  ],
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "duration_ms": 13
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false
      }
    },
    "/v1/import_taxes": {
      "post": {
        "operationId": "createImportTax",
        "summary": "Import VAT / GST rules for a country, and the VAT on a shipment when goods_value is sent",
        "description": "Key scope: read (or execute).",
        "tags": [
          "import_taxes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country_code": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "ISO 3166-1 alpha-2 country code"
                  },
                  "destination_country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "Deprecated: use country_code",
                    "deprecated": true
                  },
                  "goods_value": {
                    "type": "number",
                    "minimum": 0
                  },
                  "duty_amount": {
                    "type": "number",
                    "minimum": 0
                  },
                  "hs_code": {
                    "type": "string",
                    "maxLength": 17,
                    "description": "Optional: the goods' HS code. Canada: goods that are zero-rated basic groceries (coffee, tea) pay no GST on import"
                  }
                },
                "required": [
                  "country_code"
                ],
                "additionalProperties": false
              },
              "example": {
                "country_code": "DE",
                "goods_value": 12500,
                "duty_amount": 1500
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportTax"
                },
                "example": {
                  "request_id": "e3ce16f7-6d87-4941-b9ff-5d19b2d80f71",
                  "country_code": "DE",
                  "country_name": "Germany",
                  "standard_vat_rate": 19,
                  "reduced_rates": [
                    {
                      "rate": 7,
                      "categories": [
                        "food"
                      ]
                    }
                  ],
                  "import_vat_applies": true,
                  "vat_on_duty": true,
                  "exemptions": [],
                  "registration_threshold": null,
                  "currency": "EUR",
                  "notes": "Einfuhrumsatzsteuer on CIF + duty",
                  "source_url": null,
                  "rate_status": "unverified",
                  "verified_on": null,
                  "vat_calculation": {
                    "goods_value": 10000,
                    "duty_amount": 1200,
                    "taxable_base": 11200,
                    "vat_rate_percent": 19,
                    "vat_amount": 2128,
                    "total_with_vat": 13328,
                    "note": "VAT calculated on goods value + duty amount."
                  },
                  "duration_ms": 2,
                  "disclaimer": "VAT/GST rates are provided for informational purposes. Actual rates may vary by product category, trade agreements, and specific exemptio..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false
      },
      "get": {
        "operationId": "getImportTax",
        "summary": "The same as POST, with query parameters",
        "description": "Key scope: read (or execute).",
        "tags": [
          "import_taxes"
        ],
        "parameters": [
          {
            "name": "country_code",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "ISO 3166-1 alpha-2 country code"
          },
          {
            "name": "goods_value",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "duty_amount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "hs_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 17
            },
            "description": "Optional: the goods' HS code (Canada's zero-rated groceries)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportTax"
                },
                "example": {
                  "request_id": "b32a68ec-73db-4f58-918f-3431b680b3dc",
                  "country_code": "GB",
                  "country_name": "United Kingdom",
                  "standard_vat_rate": 20,
                  "reduced_rates": [
                    {
                      "rate": 5,
                      "categories": [
                        "child car seats"
                      ]
                    }
                  ],
                  "import_vat_applies": true,
                  "vat_on_duty": true,
                  "exemptions": [],
                  "registration_threshold": null,
                  "currency": "GBP",
                  "notes": "VAT applies on CIF + duty",
                  "source_url": null,
                  "rate_status": "unverified",
                  "verified_on": null,
                  "vat_calculation": {
                    "goods_value": 10000,
                    "duty_amount": 1200,
                    "taxable_base": 11200,
                    "vat_rate_percent": 20,
                    "vat_amount": 2240,
                    "total_with_vat": 13440,
                    "note": "VAT calculated on goods value + duty amount."
                  },
                  "duration_ms": 2,
                  "disclaimer": "VAT/GST rates are provided for informational purposes. Actual rates may vary by product category, trade agreements, and specific exemptio..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false
      }
    },
    "/v1/ingest/competitor_data": {
      "post": {
        "operationId": "ingestCompetitorData",
        "summary": "Push competitor brands, styles and trend signals: at least one of brands, styles or signals is required. One bad record writes nothing",
        "description": "Key scope: ingest. Module: competitor_intel. API key only (no session).",
        "tags": [
          "ingest"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "brands": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Cut to 256 characters"
                        },
                        "is_own": {
                          "type": "boolean",
                          "default": false,
                          "description": "Your own brand"
                        },
                        "attributes": {
                          "type": "object"
                        }
                      },
                      "required": [
                        "external_id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 1000,
                    "description": "Unique external_id within the batch; upserted by external_id"
                  },
                  "styles": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "brand_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "description": "A brand in this batch or one ingested before"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Cut to 256 characters"
                        },
                        "category": {
                          "type": "string",
                          "description": "Cut to 128 characters"
                        },
                        "subcategory": {
                          "type": "string",
                          "description": "Cut to 128 characters"
                        },
                        "price_tier": {
                          "type": "string",
                          "description": "Cut to 64 characters"
                        },
                        "launch_date": {
                          "type": "string",
                          "format": "date"
                        },
                        "image_url": {
                          "type": "string",
                          "maxLength": 1024,
                          "description": "http or https URL"
                        },
                        "attributes": {
                          "type": "object",
                          "additionalProperties": {
                            "type": [
                              "string",
                              "number",
                              "boolean",
                              "null"
                            ]
                          },
                          "description": "Flat merchandising values, e.g. silhouette, material, color"
                        }
                      },
                      "required": [
                        "external_id",
                        "brand_external_id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 5000,
                    "description": "Unique external_id within the batch; upserted by external_id"
                  },
                  "signals": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "subject_type": {
                          "type": "string",
                          "enum": [
                            "style",
                            "attribute",
                            "category"
                          ]
                        },
                        "subject_key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256,
                          "description": "A style external_id, dimension:value for an attribute, or a category"
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "social",
                            "search",
                            "editorial",
                            "manual"
                          ]
                        },
                        "score": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "window_days": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 730,
                          "default": 30
                        },
                        "captured_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "With Z or an offset; default now"
                        },
                        "attributes": {
                          "type": "object"
                        }
                      },
                      "required": [
                        "subject_type",
                        "subject_key",
                        "source",
                        "score"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 10000,
                    "description": "Appended"
                  },
                  "replace_signal_sources": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "social",
                        "search",
                        "editorial",
                        "manual"
                      ]
                    },
                    "maxItems": 5,
                    "description": "With signals: once they are written, this organization's older signals of these sources are deleted"
                  }
                },
                "additionalProperties": false,
                "description": "At least one of brands, styles, signals; at most 4194304 bytes (413 above). A 400 lists every field error in details[] (field, message)"
              },
              "example": {
                "brands": [
                  {
                    "external_id": "BR-ALDER",
                    "name": "Alder & Finch"
                  }
                ],
                "styles": [
                  {
                    "external_id": "ST-9001",
                    "brand_external_id": "BR-ALDER",
                    "name": "Canvas tote, medium",
                    "category": "handbag",
                    "price_tier": "mid",
                    "launch_date": "2026-11-20",
                    "attributes": {
                      "silhouette": "tote",
                      "material": "canvas",
                      "color": "natural"
                    }
                  }
                ],
                "signals": [
                  {
                    "subject_type": "style",
                    "subject_key": "ST-9001",
                    "source": "search",
                    "score": 72,
                    "window_days": 30,
                    "captured_at": "2026-12-01T08:00:00Z"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "ingested": {
                      "type": "object",
                      "properties": {
                        "brands": {
                          "type": "integer"
                        },
                        "styles": {
                          "type": "integer"
                        },
                        "signals": {
                          "type": "integer"
                        },
                        "signals_replaced": {
                          "type": "integer",
                          "description": "Older signals of replace_signal_sources deleted once the new ones were written"
                        }
                      },
                      "description": "Records written, per kind the batch held"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "duration_ms",
                    "ingested",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "33940c2c-6763-4dec-903c-caed9c710c0a",
                  "duration_ms": 13,
                  "ingested": {
                    "brands": 1,
                    "styles": 1,
                    "signals_replaced": 1,
                    "signals": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "competitor_intel",
        "x-writes": true
      }
    },
    "/v1/ingest/records": {
      "post": {
        "operationId": "ingestRecords",
        "summary": "Push canonical supply-chain records; idempotent upsert by external_id, per-entity counts. Optional Idempotency-Key header. The body is at most 2 MB (413 above)",
        "description": "Key scope: ingest. Module: connectors. Takes Idempotency-Key (applied by the route itself). At most 50 record errors are returned; `error_count` is the full number",
        "tags": [
          "ingest"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe: the same key and body answers from the first run without storing anything again (replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connection": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Connection name (default 'default')"
                  },
                  "entities": {
                    "type": "object",
                    "properties": {
                      "suppliers": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "name": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "city": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "lead_time_days": {
                              "type": "integer",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "external_id",
                            "name"
                          ]
                        }
                      },
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "description": {
                              "type": "string",
                              "maxLength": 500
                            },
                            "uom": {
                              "type": "string",
                              "maxLength": 10,
                              "description": "Unit of measure"
                            },
                            "category": {
                              "type": "string",
                              "maxLength": 100
                            },
                            "unit_cost": {
                              "type": "number",
                              "minimum": 0
                            },
                            "hs_code": {
                              "type": "string",
                              "maxLength": 20,
                              "description": "HS / HTS code, 4 to 10 digits, dots allowed"
                            },
                            "country_of_origin": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$",
                              "description": "Where the item is made or grown. Left out: the stored value stays; null clears it"
                            },
                            "net_weight_kg": {
                              "type": "number",
                              "minimum": 0,
                              "description": "Net weight of one unit (uom) in kilograms. Left out: the stored value stays"
                            },
                            "gtin": {
                              "type": "string",
                              "maxLength": 14,
                              "description": "GTIN-8, 12, 13 or 14 as a string of digits; the check digit is verified. Stored as GTIN-14. Left out: the stored value stays"
                            }
                          },
                          "required": [
                            "external_id"
                          ]
                        }
                      },
                      "item_variants": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "item_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the item"
                            },
                            "variant_code": {
                              "type": "string",
                              "maxLength": 30
                            }
                          },
                          "required": [
                            "external_id",
                            "item_external_id",
                            "variant_code"
                          ]
                        }
                      },
                      "product_lots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "item_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the item"
                            },
                            "lot_code": {
                              "type": "string",
                              "maxLength": 50
                            },
                            "expiry_date": {
                              "type": "string",
                              "format": "date"
                            },
                            "manufactured_date": {
                              "type": "string",
                              "format": "date"
                            },
                            "supplier_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the supplier the lot was bought from"
                            },
                            "country_of_origin": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$",
                              "description": "The lot's own origin, which can differ from its item's"
                            },
                            "quantity": {
                              "type": "number",
                              "minimum": 0,
                              "description": "The lot's size, in unit"
                            },
                            "unit": {
                              "type": "string",
                              "maxLength": 10,
                              "description": "Unit of quantity"
                            }
                          },
                          "required": [
                            "external_id",
                            "item_external_id",
                            "lot_code"
                          ]
                        }
                      },
                      "locations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "name": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "city": {
                              "type": "string",
                              "maxLength": 200
                            }
                          },
                          "required": [
                            "external_id",
                            "name"
                          ]
                        }
                      },
                      "customers": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "name": {
                              "type": "string",
                              "maxLength": 200
                            }
                          },
                          "required": [
                            "external_id",
                            "name"
                          ]
                        }
                      },
                      "price_lists": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "name": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "entries": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "item_external_id": {
                                    "type": "string",
                                    "maxLength": 50,
                                    "description": "The external_id of the item"
                                  },
                                  "unit_price": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": [
                                  "item_external_id",
                                  "unit_price"
                                ]
                              },
                              "description": "A line that lacks a required field is an error on the record"
                            }
                          },
                          "required": [
                            "external_id",
                            "name"
                          ]
                        }
                      },
                      "inventory_levels": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "item_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the item"
                            },
                            "location_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the location"
                            },
                            "quantity_on_hand": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "item_external_id",
                            "location_external_id",
                            "quantity_on_hand"
                          ]
                        }
                      },
                      "purchase_orders": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "supplier_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the supplier"
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "line_number": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "item_external_id": {
                                    "type": "string",
                                    "maxLength": 50,
                                    "description": "The external_id of the item"
                                  },
                                  "quantity": {
                                    "type": "number",
                                    "minimum": 0
                                  },
                                  "location_external_id": {
                                    "type": "string",
                                    "maxLength": 50,
                                    "description": "The external_id of the location it is delivered to"
                                  },
                                  "unit_price": {
                                    "type": "number",
                                    "minimum": 0,
                                    "description": "The price of one unit; with price_unit_quantity, the price of that many units"
                                  },
                                  "expected_delivery_date": {
                                    "type": "string",
                                    "format": "date"
                                  },
                                  "unit_of_measure": {
                                    "type": "string",
                                    "maxLength": 10,
                                    "description": "The order unit of quantity"
                                  },
                                  "price_unit_quantity": {
                                    "type": "number",
                                    "minimum": 0,
                                    "description": "The quantity unit_price is stated for (SAP NetPriceQuantity), above 0. The price is stored per one unit"
                                  }
                                },
                                "required": [
                                  "line_number",
                                  "item_external_id",
                                  "quantity"
                                ]
                              },
                              "description": "A line that lacks a required field is an error on the record"
                            },
                            "status": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "open, partially_received, received or cancelled; open when left out"
                            },
                            "order_date": {
                              "type": "string",
                              "format": "date"
                            },
                            "currency": {
                              "type": "string",
                              "maxLength": 3,
                              "description": "ISO 4217 code of the order's prices"
                            },
                            "expected_delivery_date": {
                              "type": "string",
                              "format": "date"
                            },
                            "lines_complete": {
                              "type": "boolean",
                              "description": "True when lines is the order's full current item list: stored lines not in it are removed"
                            }
                          },
                          "required": [
                            "external_id",
                            "supplier_external_id"
                          ]
                        }
                      },
                      "goods_receipts": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "document_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The material document"
                            },
                            "po_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the purchase order"
                            },
                            "po_line_number": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "posting_date": {
                              "type": "string",
                              "format": "date"
                            },
                            "quantity": {
                              "type": "number",
                              "description": "Signed: a reversal is negative"
                            },
                            "lot_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the lot (batch) received"
                            }
                          },
                          "required": [
                            "external_id",
                            "document_external_id",
                            "po_external_id",
                            "po_line_number",
                            "posting_date",
                            "quantity"
                          ]
                        }
                      },
                      "stock_movements": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "document_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The material document"
                            },
                            "item_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the item"
                            },
                            "location_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the location the stock moved in or out of"
                            },
                            "posting_date": {
                              "type": "string",
                              "format": "date"
                            },
                            "quantity": {
                              "type": "number",
                              "description": "Signed at this location: into it positive, out of it negative"
                            },
                            "counterpart_location_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the other location of a transfer"
                            },
                            "movement_kind": {
                              "type": "string",
                              "enum": [
                                "transfer",
                                "goods_issue",
                                "production_issue",
                                "production_receipt",
                                "scrap",
                                "count_adjustment",
                                "receipt_other",
                                "sales_issue",
                                "customer_return",
                                "other"
                              ]
                            }
                          },
                          "required": [
                            "external_id",
                            "document_external_id",
                            "item_external_id",
                            "location_external_id",
                            "posting_date",
                            "quantity"
                          ]
                        }
                      },
                      "lot_transformations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "process_type": {
                              "type": "string",
                              "enum": [
                                "blend",
                                "roast",
                                "grind",
                                "pack",
                                "repack",
                                "other"
                              ]
                            },
                            "location_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the location (plant) of the step"
                            },
                            "transformation_date": {
                              "type": "string",
                              "format": "date"
                            },
                            "inputs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lot_external_id": {
                                    "type": "string",
                                    "maxLength": 50,
                                    "description": "The external_id of the lot"
                                  },
                                  "quantity": {
                                    "type": "number",
                                    "minimum": 0,
                                    "description": "Above 0"
                                  },
                                  "unit": {
                                    "type": "string",
                                    "maxLength": 10,
                                    "description": "Unit of quantity"
                                  }
                                },
                                "required": [
                                  "lot_external_id",
                                  "quantity",
                                  "unit"
                                ]
                              },
                              "minItems": 1,
                              "maxItems": 500,
                              "description": "The lots consumed. Sending the record again replaces its inputs and outputs"
                            },
                            "outputs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lot_external_id": {
                                    "type": "string",
                                    "maxLength": 50,
                                    "description": "The external_id of the lot"
                                  },
                                  "quantity": {
                                    "type": "number",
                                    "minimum": 0,
                                    "description": "Above 0"
                                  },
                                  "unit": {
                                    "type": "string",
                                    "maxLength": 10,
                                    "description": "Unit of quantity"
                                  }
                                },
                                "required": [
                                  "lot_external_id",
                                  "quantity",
                                  "unit"
                                ]
                              },
                              "minItems": 1,
                              "maxItems": 500,
                              "description": "The lots produced"
                            },
                            "process_order_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The production or process order the step was posted against"
                            }
                          },
                          "required": [
                            "external_id",
                            "process_type",
                            "location_external_id",
                            "transformation_date",
                            "inputs",
                            "outputs"
                          ]
                        }
                      },
                      "sales_orders": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "line_number": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "item_external_id": {
                                    "type": "string",
                                    "maxLength": 50,
                                    "description": "The external_id of the item"
                                  },
                                  "quantity": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": [
                                  "line_number",
                                  "item_external_id",
                                  "quantity"
                                ]
                              },
                              "description": "A line that lacks a required field is an error on the record"
                            }
                          },
                          "required": [
                            "external_id"
                          ]
                        }
                      },
                      "deliveries": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "line_number": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "item_external_id": {
                                    "type": "string",
                                    "maxLength": 50,
                                    "description": "The external_id of the item"
                                  },
                                  "quantity": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": [
                                  "line_number",
                                  "item_external_id",
                                  "quantity"
                                ]
                              },
                              "description": "A line that lacks a required field is an error on the record"
                            }
                          },
                          "required": [
                            "external_id"
                          ]
                        }
                      },
                      "billing_documents": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "line_number": {
                                    "type": "integer",
                                    "minimum": 1
                                  }
                                },
                                "required": [
                                  "line_number"
                                ]
                              },
                              "description": "A line that lacks a required field is an error on the record"
                            }
                          },
                          "required": [
                            "external_id"
                          ]
                        }
                      },
                      "returns": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "line_number": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "item_external_id": {
                                    "type": "string",
                                    "maxLength": 50,
                                    "description": "The external_id of the item"
                                  },
                                  "quantity": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": [
                                  "line_number",
                                  "item_external_id",
                                  "quantity"
                                ]
                              },
                              "description": "A line that lacks a required field is an error on the record"
                            }
                          },
                          "required": [
                            "external_id"
                          ]
                        }
                      },
                      "pos_transactions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "Your id for the record; sending it again updates the record"
                            },
                            "item_external_id": {
                              "type": "string",
                              "maxLength": 50,
                              "description": "The external_id of the item"
                            },
                            "transaction_date": {
                              "type": "string",
                              "format": "date"
                            },
                            "quantity": {
                              "type": "number",
                              "description": "Signed: a return is negative"
                            }
                          },
                          "required": [
                            "external_id",
                            "item_external_id",
                            "transaction_date",
                            "quantity"
                          ]
                        }
                      }
                    },
                    "additionalProperties": false,
                    "description": "1-1000 records across all entities: at least one entity with at least one record. A record that lacks a required field is reported in the response and the others are stored"
                  }
                },
                "required": [
                  "entities"
                ],
                "additionalProperties": false
              },
              "example": {
                "connection": "default",
                "entities": {
                  "suppliers": [
                    {
                      "external_id": "SUP-100",
                      "name": "Northwind Textiles Ltd",
                      "city": "Hai Phong",
                      "lead_time_days": 35
                    }
                  ],
                  "items": [
                    {
                      "external_id": "SKU-100",
                      "description": "Cotton T-shirt, white",
                      "uom": "EA",
                      "category": "Tops",
                      "unit_cost": 6.4,
                      "country_of_origin": "VN",
                      "net_weight_kg": 0.18,
                      "gtin": "00400000000121"
                    },
                    {
                      "external_id": "FAB-200",
                      "description": "Cotton jersey, undyed",
                      "uom": "KG",
                      "category": "Fabric"
                    }
                  ],
                  "product_lots": [
                    {
                      "external_id": "FAB-200-L1",
                      "item_external_id": "FAB-200",
                      "lot_code": "L1",
                      "supplier_external_id": "SUP-100",
                      "country_of_origin": "VN",
                      "quantity": 400,
                      "unit": "KG"
                    },
                    {
                      "external_id": "SKU-100-B7",
                      "item_external_id": "SKU-100",
                      "lot_code": "B7",
                      "manufactured_date": "2026-11-30"
                    }
                  ],
                  "locations": [
                    {
                      "external_id": "DC-01",
                      "name": "West distribution centre",
                      "city": "Portland"
                    }
                  ],
                  "inventory_levels": [
                    {
                      "item_external_id": "SKU-100",
                      "location_external_id": "DC-01",
                      "quantity_on_hand": 1840
                    }
                  ],
                  "purchase_orders": [
                    {
                      "external_id": "PO-7781",
                      "supplier_external_id": "SUP-100",
                      "currency": "USD",
                      "lines": [
                        {
                          "line_number": 1,
                          "item_external_id": "SKU-100",
                          "location_external_id": "DC-01",
                          "quantity": 1000,
                          "unit_price": 640,
                          "price_unit_quantity": 100,
                          "unit_of_measure": "EA",
                          "expected_delivery_date": "2026-12-18"
                        }
                      ]
                    }
                  ],
                  "lot_transformations": [
                    {
                      "external_id": "CUT-0042",
                      "process_type": "other",
                      "location_external_id": "DC-01",
                      "transformation_date": "2026-11-30",
                      "process_order_external_id": "WO-1188",
                      "inputs": [
                        {
                          "lot_external_id": "FAB-200-L1",
                          "quantity": 180,
                          "unit": "KG"
                        }
                      ],
                      "outputs": [
                        {
                          "lot_external_id": "SKU-100-B7",
                          "quantity": 1000,
                          "unit": "EA"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "The ingest run; GET /v1/sync_runs lists it"
                    },
                    "connection": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The connection the records were stored under; null only on a replay whose connection has since been removed"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "success",
                        "partial",
                        "failed"
                      ],
                      "description": "success: every record stored. partial: some refused. failed: none stored"
                    },
                    "results": {
                      "type": "object",
                      "additionalProperties": {
                        "$ref": "#/components/schemas/IngestEntityCounts"
                      },
                      "description": "Counts per entity (suppliers, items, locations, purchase_orders, ...); every entity is listed, sent or not"
                    },
                    "error_count": {
                      "type": "integer",
                      "description": "Records refused, in full"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/IngestRecordError"
                      }
                    },
                    "duration_ms": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "replayed": {
                      "const": true,
                      "description": "Present when the Idempotency-Key was already used with the same body: this is the first run's result, nothing was processed again"
                    },
                    "original_request_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "With replayed: the request_id of the run that did the work"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "run_id",
                    "connection",
                    "status",
                    "results",
                    "error_count",
                    "errors",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "2e885a5c-6399-4ca2-b76f-dd5a39550562",
                  "run_id": "7f5ae59e-2c72-417f-af0a-8c79219a6779",
                  "connection": "erp-main",
                  "status": "success",
                  "results": {
                    "suppliers": {
                      "received": 0,
                      "upserted": 0,
                      "failed": 0
                    },
                    "items": {
                      "received": 1,
                      "upserted": 1,
                      "failed": 0
                    }
                  },
                  "error_count": 0,
                  "errors": [],
                  "duration_ms": 8
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "connectors",
        "x-writes": true
      }
    },
    "/v1/ingest/sensor_events": {
      "post": {
        "operationId": "ingestSensorEvents",
        "summary": "Push RFID, ambient IoT, temperature and GPS reads. The body is at most 2 MB (413 above)",
        "description": "Key scope: ingest. Module: sensing. API key only (no session). At most the first 50 rejected events are listed in `errors`; `error_count` is the full number",
        "tags": [
          "ingest"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connection": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "A name for where the reads come from (default 'sensing')"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "description": "One of epc or item_external_id is required. An event that lacks a required field is reported in the response's errors and the others are stored",
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "rfid",
                            "ambient_iot",
                            "temp",
                            "gps",
                            "manual"
                          ]
                        },
                        "event_type": {
                          "type": "string",
                          "enum": [
                            "read",
                            "move",
                            "temp",
                            "dwell"
                          ]
                        },
                        "observed_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "epc": {
                          "type": "string",
                          "maxLength": 128,
                          "description": "The tag. Required unless item_external_id is sent"
                        },
                        "item_external_id": {
                          "type": "string",
                          "maxLength": 50,
                          "description": "Required unless epc is sent"
                        },
                        "lot_external_id": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "location_external_id": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "value": {
                          "type": "object",
                          "description": "The reading. Required when event_type is temp, with a numeric temperature_c"
                        },
                        "attributes": {
                          "type": "object"
                        }
                      },
                      "required": [
                        "source",
                        "event_type",
                        "observed_at"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 1000
                  }
                },
                "required": [
                  "events"
                ],
                "additionalProperties": false
              },
              "example": {
                "events": [
                  {
                    "source": "rfid",
                    "event_type": "read",
                    "observed_at": "2026-12-01T09:30:00Z",
                    "epc": "urn:epc:id:sgtin:0400000.000012.1001",
                    "location_external_id": "STORE-12"
                  },
                  {
                    "source": "temp",
                    "event_type": "temp",
                    "observed_at": "2026-12-01T09:31:00Z",
                    "item_external_id": "SKU-310",
                    "location_external_id": "DC-01",
                    "value": {
                      "temperature_c": 4.6
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "The ingest run this push was recorded as"
                    },
                    "connection": {
                      "type": "string",
                      "description": "The connection the events were filed under"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "success",
                        "partial",
                        "failed"
                      ],
                      "description": "success: no event was rejected; partial: some were rejected and some new ones stored; failed: some were rejected and no new one stored"
                    },
                    "results": {
                      "type": "object",
                      "properties": {
                        "events": {
                          "type": "object",
                          "properties": {
                            "received": {
                              "type": "integer",
                              "description": "Events in the request; `upserted` counts the new ones (an event sent before is not stored twice)"
                            },
                            "upserted": {
                              "type": "integer"
                            },
                            "failed": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "received",
                            "upserted",
                            "failed"
                          ]
                        },
                        "tracked_items": {
                          "type": "object",
                          "properties": {
                            "received": {
                              "type": "integer",
                              "description": "Tracked entities (a tag, or an item, lot and location) the valid events touched"
                            },
                            "upserted": {
                              "type": "integer"
                            },
                            "failed": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "received",
                            "upserted",
                            "failed"
                          ]
                        }
                      },
                      "required": [
                        "events",
                        "tracked_items"
                      ]
                    },
                    "error_count": {
                      "type": "integer"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "description": "Position of the event in the request's events array"
                          },
                          "external_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The event's epc, else its item_external_id, when it had one"
                          },
                          "errors": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "field": {
                                  "type": "string"
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "field",
                                "message"
                              ]
                            }
                          }
                        },
                        "required": [
                          "index",
                          "external_id",
                          "errors"
                        ]
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "run_id",
                    "connection",
                    "status",
                    "results",
                    "error_count",
                    "errors",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "75d8543f-1acb-4fe8-8c15-0453be9aa072",
                  "run_id": "5149e632-4028-4dd1-a37d-fdf2f53a4fdd",
                  "connection": "store-sensors",
                  "status": "success",
                  "results": {
                    "events": {
                      "received": 2,
                      "upserted": 2,
                      "failed": 0
                    },
                    "tracked_items": {
                      "received": 1,
                      "upserted": 1,
                      "failed": 0
                    }
                  },
                  "error_count": 0,
                  "errors": [],
                  "duration_ms": 15
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "sensing",
        "x-writes": true
      }
    },
    "/v1/ingest/supplier_invoices": {
      "post": {
        "operationId": "ingestSupplierInvoices",
        "summary": "Push supplier invoices (structured, or raw text to extract); matched three ways and turned into exceptions. The body is at most 4 MB (413 above)",
        "description": "Key scope: ingest. Module: accounts_payable. API key only (no session). At most the first 50 rejected invoices are listed in `errors`; `error_count` is the full number",
        "tags": [
          "ingest"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connection": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "A name for where the invoices come from"
                  },
                  "invoices": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "description": "One of raw_text, or invoice_number with total_amount, is required. An invoice with neither is reported in the response's errors and the others are stored",
                      "properties": {
                        "invoice_number": {
                          "type": "string",
                          "maxLength": 100,
                          "description": "Required unless raw_text is sent"
                        },
                        "total_amount": {
                          "type": "number",
                          "minimum": 0,
                          "description": "Required unless raw_text is sent"
                        },
                        "raw_text": {
                          "type": "string",
                          "description": "The invoice as text, to extract the fields from. Required unless invoice_number and total_amount are sent"
                        },
                        "supplier_external_id": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "po_external_id": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "invoice_date": {
                          "type": "string",
                          "format": "date"
                        },
                        "due_date": {
                          "type": "string",
                          "format": "date"
                        },
                        "currency": {
                          "type": "string",
                          "maxLength": 8
                        },
                        "payment_terms": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "subtotal_amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "tax_amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "edi",
                            "email_pdf",
                            "manual",
                            "api",
                            "erp"
                          ],
                          "default": "api"
                        },
                        "invoice_id": {
                          "type": "string",
                          "maxLength": 128,
                          "description": "Your id for the invoice; sending it again updates the invoice"
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "quantity": {
                                "type": "number",
                                "minimum": 0
                              },
                              "unit_price": {
                                "type": "number",
                                "minimum": 0
                              },
                              "item_external_id": {
                                "type": "string",
                                "maxLength": 64
                              },
                              "description": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "po_line_external_id": {
                                "type": "string",
                                "maxLength": 64
                              },
                              "line_total": {
                                "type": "number",
                                "minimum": 0
                              },
                              "line_number": {
                                "type": "integer",
                                "minimum": 1
                              }
                            },
                            "required": [
                              "quantity",
                              "unit_price"
                            ]
                          },
                          "maxItems": 500
                        }
                      }
                    },
                    "minItems": 1,
                    "maxItems": 500
                  }
                },
                "required": [
                  "invoices"
                ],
                "additionalProperties": false
              },
              "example": {
                "invoices": [
                  {
                    "invoice_number": "INV-2041",
                    "total_amount": 6400,
                    "supplier_external_id": "SUP-100",
                    "po_external_id": "PO-7781",
                    "invoice_date": "2026-12-01",
                    "due_date": "2026-12-31",
                    "currency": "USD",
                    "payment_terms": "2/10 net 30",
                    "lines": [
                      {
                        "line_number": 1,
                        "item_external_id": "SKU-100",
                        "description": "Cotton T-shirt, white",
                        "quantity": 1000,
                        "unit_price": 6.4,
                        "line_total": 6400
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run_id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "The ingest run this push was recorded as"
                    },
                    "connection": {
                      "type": "string",
                      "description": "The connection the invoices were filed under"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "success",
                        "partial",
                        "failed"
                      ],
                      "description": "success: no invoice was rejected; partial: some were rejected and some stored; failed: some were rejected and none stored"
                    },
                    "results": {
                      "type": "object",
                      "properties": {
                        "invoices": {
                          "type": "object",
                          "properties": {
                            "received": {
                              "type": "integer"
                            },
                            "upserted": {
                              "type": "integer"
                            },
                            "failed": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "received",
                            "upserted",
                            "failed"
                          ]
                        },
                        "exceptions": {
                          "type": "object",
                          "properties": {
                            "created": {
                              "type": "integer",
                              "description": "Exceptions the match and duplicate checks raised on the stored invoices"
                            }
                          },
                          "required": [
                            "created"
                          ]
                        },
                        "extracted": {
                          "type": "integer",
                          "description": "Invoices sent as raw text that were read into fields and stored"
                        }
                      },
                      "required": [
                        "invoices",
                        "exceptions",
                        "extracted"
                      ]
                    },
                    "error_count": {
                      "type": "integer"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "description": "Position of the invoice in the request's invoices array"
                          },
                          "invoice_number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "errors": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "field": {
                                  "type": "string"
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "field",
                                "message"
                              ]
                            }
                          }
                        },
                        "required": [
                          "index",
                          "invoice_number",
                          "errors"
                        ]
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "run_id",
                    "connection",
                    "status",
                    "results",
                    "error_count",
                    "errors",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "092356f1-cf9b-4a88-ab85-191b812fd445",
                  "run_id": "c478003a-39ad-497c-a0a6-ebda7016b530",
                  "connection": "payables-inbox",
                  "status": "success",
                  "results": {
                    "invoices": {
                      "received": 1,
                      "upserted": 1,
                      "failed": 0
                    },
                    "exceptions": {
                      "created": 2
                    },
                    "extracted": 0
                  },
                  "error_count": 0,
                  "errors": [],
                  "duration_ms": 19
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "accounts_payable",
        "x-writes": true
      }
    },
    "/v1/inventory/demand_stats": {
      "get": {
        "operationId": "listDemandStats",
        "summary": "Demand classification and statistics per item and location",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `demand_stats`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryDemandStats"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "demand_stats": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryDemandStats"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging"
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "demand_stats",
                    "window_days",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "total",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "fd315933-138a-4496-aaa1-ee7b07dda538",
                  "window_days": 90,
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 100,
                  "total": 7378,
                  "has_more": true,
                  "demand_stats": [
                    {
                      "item": "MAT-00000028",
                      "description": "Small Leather Goods - Style 00000028",
                      "location": "1005",
                      "windowDays": 90,
                      "totalQuantity": 1090,
                      "nonZeroDays": 11,
                      "meanDaily": 12.1111,
                      "stdDevDaily": 46.2276,
                      "cv": 3.817,
                      "adi": 8.1818,
                      "classification": "lumpy"
                    }
                  ],
                  "duration_ms": 381,
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000028",
                      "description": "Small Leather Goods - Style 00000028",
                      "location": "1005",
                      "windowDays": 90,
                      "totalQuantity": 1090,
                      "nonZeroDays": 11,
                      "meanDaily": 12.1111,
                      "stdDevDaily": 46.2276,
                      "cv": 3.817,
                      "adi": 8.1818,
                      "classification": "lumpy"
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "demand_stats"
        }
      }
    },
    "/v1/inventory/esg_footprint": {
      "get": {
        "operationId": "getEsgFootprint",
        "summary": "Estimated Scope 3 footprint of a reporting period from published emission factors and the account's own, by method, supplier, item and category, with the lines that have no factor",
        "description": "Key scope: read (or execute). Module: esg. suppliers, items and transport.lanes each carry the top `limit` rows (default 100, at most 200) with no further page; supplier_count, item_count and transport.lanes_total say how many exist",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            },
            "description": "A calendar year"
          },
          {
            "name": "fiscal_year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            },
            "description": "The account's fiscal year, named by the year it ends"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Custom period start, with to"
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Custom period end, inclusive"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "$ref": "#/components/schemas/EsgPeriod"
                    },
                    "total_kg_co2e": {
                      "type": "number",
                      "description": "Scope 3 category 1 of the counted lines"
                    },
                    "total_t_co2e": {
                      "type": "number"
                    },
                    "luc_kg_co2e": {
                      "type": "number",
                      "description": "Of the total, land-use change where the factor publishes it"
                    },
                    "scope_categories": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "category": {
                            "type": "number",
                            "enum": [
                              1,
                              4
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "kg_co2e": {
                            "type": "number"
                          },
                          "included_in_total": {
                            "type": "boolean"
                          },
                          "note": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "category",
                          "name",
                          "kg_co2e",
                          "included_in_total",
                          "note"
                        ]
                      }
                    },
                    "methods": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "method": {
                            "type": "string",
                            "enum": [
                              "primary",
                              "mass",
                              "spend",
                              "no_factor"
                            ]
                          },
                          "kg_co2e": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "share_of_emissions_pct": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "lines": {
                            "type": "integer"
                          },
                          "share_of_lines_pct": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "method",
                          "kg_co2e",
                          "share_of_emissions_pct",
                          "lines",
                          "share_of_lines_pct"
                        ]
                      }
                    },
                    "no_factor_share_pct": {
                      "type": "number",
                      "description": "Purchase lines in the period with no factor, percent; they are not counted"
                    },
                    "lines_in_period": {
                      "type": "integer",
                      "description": "Dated, not cancelled purchase order lines in the period"
                    },
                    "lines_counted": {
                      "type": "integer"
                    },
                    "spend_usd_counted": {
                      "type": "number"
                    },
                    "mass_kg_counted": {
                      "type": "number"
                    },
                    "buckets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "bucket": {
                            "type": "string",
                            "enum": [
                              "no_mapping",
                              "no_weight",
                              "no_price",
                              "no_fx_rate",
                              "no_currency",
                              "origin_not_covered",
                              "cancelled",
                              "no_order_date"
                            ]
                          },
                          "label": {
                            "type": "string"
                          },
                          "lines": {
                            "type": "integer"
                          },
                          "items": {
                            "type": "integer"
                          },
                          "value_by_currency": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "number"
                            },
                            "description": "Value in each order currency; none when no currency is stated"
                          },
                          "in_no_factor_share": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "bucket",
                          "label",
                          "lines",
                          "items",
                          "value_by_currency",
                          "in_no_factor_share"
                        ]
                      },
                      "description": "Lines not counted, and why"
                    },
                    "suppliers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kg_co2e": {
                            "type": "number"
                          },
                          "luc_kg_co2e": {
                            "type": "number"
                          },
                          "share_of_footprint_pct": {
                            "type": "number"
                          },
                          "spend_usd": {
                            "type": "number",
                            "description": "US dollars of the counted lines"
                          },
                          "methods": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "primary",
                                "mass",
                                "spend"
                              ],
                              "description": "primary: the account's own factor; mass: quantity x weight x a kg CO2e per kg factor; spend: US dollars x a kg CO2e per dollar factor"
                            }
                          },
                          "country": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "external_id",
                          "name",
                          "kg_co2e",
                          "luc_kg_co2e",
                          "share_of_footprint_pct",
                          "spend_usd",
                          "methods",
                          "country"
                        ]
                      },
                      "description": "Largest footprint first; the top `limit`"
                    },
                    "supplier_count": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kg_co2e": {
                            "type": "number"
                          },
                          "luc_kg_co2e": {
                            "type": "number"
                          },
                          "share_of_footprint_pct": {
                            "type": "number"
                          },
                          "spend_usd": {
                            "type": "number",
                            "description": "US dollars of the counted lines"
                          },
                          "methods": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "primary",
                                "mass",
                                "spend"
                              ],
                              "description": "primary: the account's own factor; mass: quantity x weight x a kg CO2e per kg factor; spend: US dollars x a kg CO2e per dollar factor"
                            }
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "origin": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "external_id",
                          "name",
                          "kg_co2e",
                          "luc_kg_co2e",
                          "share_of_footprint_pct",
                          "spend_usd",
                          "methods",
                          "description",
                          "category",
                          "origin"
                        ]
                      },
                      "description": "Largest footprint first; the top `limit`"
                    },
                    "item_count": {
                      "type": "integer"
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kg_co2e": {
                            "type": "number"
                          },
                          "share_of_footprint_pct": {
                            "type": "number"
                          },
                          "spend_usd": {
                            "type": "number"
                          },
                          "lines": {
                            "type": "integer"
                          },
                          "mapped": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "category",
                          "kg_co2e",
                          "share_of_footprint_pct",
                          "spend_usd",
                          "lines",
                          "mapped"
                        ]
                      }
                    },
                    "months": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "month": {
                            "type": "string",
                            "description": "YYYY-MM"
                          },
                          "kg_co2e": {
                            "type": "number"
                          },
                          "by_method": {
                            "type": "object",
                            "properties": {
                              "primary": {
                                "type": "number"
                              },
                              "mass": {
                                "type": "number"
                              },
                              "spend": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "primary",
                              "mass",
                              "spend"
                            ]
                          }
                        },
                        "required": [
                          "month",
                          "kg_co2e",
                          "by_method"
                        ]
                      }
                    },
                    "unmapped_categories": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "transport": {
                      "type": "object",
                      "properties": {
                        "total_kg_co2e": {
                          "type": "number"
                        },
                        "included_in_total": {
                          "const": false
                        },
                        "by_mode": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "ocean",
                                  "air",
                                  "road",
                                  "rail",
                                  "unknown"
                                ]
                              },
                              "lanes": {
                                "type": "integer"
                              },
                              "shipped_mass_kg": {
                                "type": "number"
                              },
                              "tonne_km": {
                                "type": "number"
                              },
                              "kg_co2e": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "mode",
                              "lanes",
                              "shipped_mass_kg",
                              "tonne_km",
                              "kg_co2e"
                            ]
                          }
                        },
                        "lanes_total": {
                          "type": "integer"
                        },
                        "lanes_estimated": {
                          "type": "integer"
                        },
                        "lanes_unknown_mode": {
                          "type": "integer"
                        },
                        "lanes_without_distance": {
                          "type": "integer"
                        },
                        "lanes_without_mass": {
                          "type": "integer"
                        },
                        "lanes_mode_assumed": {
                          "type": "integer",
                          "description": "Lanes whose mode is derived from geography, not read from shipments"
                        },
                        "lines_without_weight": {
                          "type": "integer"
                        },
                        "lanes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "supplier": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "external_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "country": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "external_id",
                                  "name",
                                  "country"
                                ]
                              },
                              "location": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "external_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "country": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "external_id",
                                  "name",
                                  "country"
                                ]
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "ocean",
                                  "air",
                                  "road",
                                  "rail",
                                  "unknown"
                                ]
                              },
                              "mode_source": {
                                "type": "string",
                                "enum": [
                                  "data",
                                  "assumed_geography"
                                ]
                              },
                              "distance_km": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "transit_days_p50": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "shipped_mass_kg": {
                                "type": "number"
                              },
                              "lines_without_weight": {
                                "type": "integer"
                              },
                              "tonne_km": {
                                "type": "number"
                              },
                              "kg_co2e_per_tonne_km": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "factor_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kg_co2e": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "basis": {
                                "type": "string",
                                "enum": [
                                  "estimated",
                                  "unknown_mode",
                                  "no_distance",
                                  "no_mass"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "supplier",
                              "location",
                              "mode",
                              "mode_source",
                              "distance_km",
                              "transit_days_p50",
                              "shipped_mass_kg",
                              "lines_without_weight",
                              "tonne_km",
                              "kg_co2e_per_tonne_km",
                              "factor_id",
                              "kg_co2e",
                              "basis"
                            ]
                          },
                          "description": "Supplier-to-location lanes; the top `limit`"
                        }
                      },
                      "required": [
                        "total_kg_co2e",
                        "included_in_total",
                        "by_mode",
                        "lanes_total",
                        "lanes_estimated",
                        "lanes_unknown_mode",
                        "lanes_without_distance",
                        "lanes_without_mass",
                        "lanes_mode_assumed",
                        "lines_without_weight",
                        "lanes"
                      ],
                      "description": "Scope 3 category 4, beside the total and not added to it"
                    },
                    "mode_shift_available": {
                      "type": "boolean",
                      "description": "False when no lane's mode came from data; mode_shifts is then empty"
                    },
                    "mode_shifts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ModeShiftCandidate"
                      },
                      "description": "Lanes known from data to run by air, largest saving first"
                    },
                    "engagement": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "external_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "country": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kg_co2e": {
                            "type": "number"
                          },
                          "share_of_footprint_pct": {
                            "type": "number"
                          },
                          "cumulative_share_pct": {
                            "type": "number"
                          },
                          "passport_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          }
                        },
                        "required": [
                          "external_id",
                          "name",
                          "country",
                          "kg_co2e",
                          "share_of_footprint_pct",
                          "cumulative_share_pct",
                          "passport_id"
                        ]
                      }
                    },
                    "supplier_governance_flags": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "supplier": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "country": {
                            "type": "string"
                          },
                          "country_code": {
                            "type": "string"
                          },
                          "risk_level": {
                            "type": "string"
                          },
                          "sanctioned": {
                            "type": "boolean"
                          },
                          "fatf_status": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reasons": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "share_of_footprint_pct": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "supplier",
                          "name",
                          "country",
                          "country_code",
                          "risk_level",
                          "sanctioned",
                          "fatf_status",
                          "reasons",
                          "share_of_footprint_pct"
                        ]
                      }
                    },
                    "methodology": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The method statement, written from the factor sets used, with their attribution"
                    },
                    "factor_sets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EmissionFactorSet"
                      }
                    },
                    "factors_used": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "factor_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "set_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "class_key": {
                            "type": "string"
                          },
                          "variant": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "value": {
                            "type": "number"
                          },
                          "unit": {
                            "type": "string"
                          },
                          "boundary": {
                            "type": "string"
                          },
                          "luc_value": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "kg_co2e": {
                            "type": "number"
                          },
                          "lines": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "factor_id",
                          "set_id",
                          "kind",
                          "class_key",
                          "variant",
                          "title",
                          "value",
                          "unit",
                          "boundary",
                          "luc_value",
                          "kg_co2e",
                          "lines"
                        ]
                      }
                    },
                    "supplied_not_applied": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "supplied_factor_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "lines": {
                            "type": "integer"
                          },
                          "reason": {
                            "type": "string",
                            "enum": [
                              "no_weight"
                            ]
                          }
                        },
                        "required": [
                          "supplied_factor_id",
                          "lines",
                          "reason"
                        ]
                      },
                      "description": "The account's own per-kg factors that matched lines with no weight per unit; those lines used the next method"
                    },
                    "settings": {
                      "type": "object",
                      "properties": {
                        "fiscal_year_start_month": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "fiscal_year_start_month"
                      ]
                    },
                    "latest_snapshot": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "period_label": {
                          "type": "string"
                        },
                        "period_start": {
                          "type": "string",
                          "format": "date"
                        },
                        "period_end": {
                          "type": "string",
                          "format": "date"
                        },
                        "computed_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "total_kg_co2e": {
                          "type": "number"
                        },
                        "no_factor_share_pct": {
                          "type": "number"
                        },
                        "trigger": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "period_label",
                        "period_start",
                        "period_end",
                        "computed_at",
                        "total_kg_co2e",
                        "no_factor_share_pct",
                        "trigger"
                      ]
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "period",
                    "total_kg_co2e",
                    "total_t_co2e",
                    "luc_kg_co2e",
                    "scope_categories",
                    "methods",
                    "no_factor_share_pct",
                    "lines_in_period",
                    "lines_counted",
                    "spend_usd_counted",
                    "mass_kg_counted",
                    "buckets",
                    "suppliers",
                    "supplier_count",
                    "items",
                    "item_count",
                    "categories",
                    "months",
                    "unmapped_categories",
                    "transport",
                    "mode_shift_available",
                    "mode_shifts",
                    "engagement",
                    "supplier_governance_flags",
                    "methodology",
                    "factor_sets",
                    "factors_used",
                    "supplied_not_applied",
                    "settings",
                    "latest_snapshot",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "5b0c8a2e-1f3d-4c6b-9a8e-2d4f6b8a0c1e",
                  "period": {
                    "start": "2025-01-01",
                    "end": "2025-12-31",
                    "label": "Calendar year 2025",
                    "kind": "calendar_year"
                  },
                  "total_kg_co2e": 26900,
                  "total_t_co2e": 26.9,
                  "luc_kg_co2e": 0,
                  "scope_categories": [
                    {
                      "category": 1,
                      "name": "Purchased goods and services",
                      "kg_co2e": 26900,
                      "included_in_total": true,
                      "note": "Purchase order lines with a factor, by the method recorded on each line"
                    }
                  ],
                  "methods": [
                    {
                      "method": "primary",
                      "kg_co2e": 0,
                      "share_of_emissions_pct": 0,
                      "lines": 0,
                      "share_of_lines_pct": 0
                    },
                    {
                      "method": "mass",
                      "kg_co2e": 0,
                      "share_of_emissions_pct": 0,
                      "lines": 0,
                      "share_of_lines_pct": 0
                    },
                    {
                      "method": "spend",
                      "kg_co2e": 26900,
                      "share_of_emissions_pct": 100,
                      "lines": 12,
                      "share_of_lines_pct": 80
                    },
                    {
                      "method": "no_factor",
                      "kg_co2e": null,
                      "share_of_emissions_pct": null,
                      "lines": 3,
                      "share_of_lines_pct": 20
                    }
                  ],
                  "no_factor_share_pct": 20,
                  "lines_in_period": 15,
                  "lines_counted": 12,
                  "spend_usd_counted": 100000,
                  "mass_kg_counted": 0,
                  "buckets": [
                    {
                      "bucket": "no_mapping",
                      "label": "No factor mapped",
                      "lines": 3,
                      "items": 1,
                      "value_by_currency": {
                        "USD": 4200
                      },
                      "in_no_factor_share": true
                    }
                  ],
                  "suppliers": [
                    {
                      "id": "3f1c2a54-6a0e-4c71-9a43-1b2c3d4e5f60",
                      "external_id": "SUP-BR-0012",
                      "name": "Cooperativa Serra Alta",
                      "country": "BR",
                      "kg_co2e": 26900,
                      "luc_kg_co2e": 0,
                      "share_of_footprint_pct": 100,
                      "spend_usd": 100000,
                      "methods": [
                        "spend"
                      ]
                    }
                  ],
                  "supplier_count": 1,
                  "items": [
                    {
                      "id": "9c8b7a6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
                      "external_id": "MAT-00000031",
                      "name": "MAT-00000031",
                      "description": "Green coffee, washed arabica",
                      "category": "GREEN_COFFEE",
                      "origin": "BR",
                      "kg_co2e": 26900,
                      "luc_kg_co2e": 0,
                      "share_of_footprint_pct": 100,
                      "spend_usd": 100000,
                      "methods": [
                        "spend"
                      ]
                    }
                  ],
                  "item_count": 1,
                  "categories": [
                    {
                      "category": "GREEN_COFFEE",
                      "kg_co2e": 26900,
                      "share_of_footprint_pct": 100,
                      "spend_usd": 100000,
                      "lines": 12,
                      "mapped": true
                    },
                    {
                      "category": "CARTONS",
                      "kg_co2e": 0,
                      "share_of_footprint_pct": 0,
                      "spend_usd": 0,
                      "lines": 3,
                      "mapped": false
                    }
                  ],
                  "months": [
                    {
                      "month": "2025-03",
                      "kg_co2e": 26900,
                      "by_method": {
                        "primary": 0,
                        "mass": 0,
                        "spend": 26900
                      }
                    }
                  ],
                  "unmapped_categories": [
                    "CARTONS"
                  ],
                  "transport": {
                    "total_kg_co2e": 774.72,
                    "included_in_total": false,
                    "by_mode": [
                      {
                        "mode": "ocean",
                        "lanes": 1,
                        "shipped_mass_kg": 6000,
                        "tonne_km": 48000,
                        "kg_co2e": 774.72
                      }
                    ],
                    "lanes_total": 1,
                    "lanes_estimated": 1,
                    "lanes_unknown_mode": 0,
                    "lanes_without_distance": 0,
                    "lanes_without_mass": 0,
                    "lanes_mode_assumed": 1,
                    "lines_without_weight": 0,
                    "lanes": [
                      {
                        "id": "1b2c3d4e-5f60-4a71-8b92-a3b4c5d6e7f8",
                        "supplier": {
                          "id": "3f1c2a54-6a0e-4c71-9a43-1b2c3d4e5f60",
                          "external_id": "SUP-BR-0012",
                          "name": "Cooperativa Serra Alta",
                          "country": "BR"
                        },
                        "location": {
                          "id": "7a2b3c4d-5e6f-4a1b-8c2d-3e4f5a6b7c8d",
                          "external_id": "PLANT-01",
                          "name": "Roastery",
                          "country": "US"
                        },
                        "mode": "ocean",
                        "mode_source": "assumed_geography",
                        "distance_km": 8000,
                        "transit_days_p50": null,
                        "shipped_mass_kg": 6000,
                        "lines_without_weight": 0,
                        "tonne_km": 48000,
                        "kg_co2e_per_tonne_km": 0.01612,
                        "factor_id": "defra-2026/freight/sea-container-ship-average",
                        "kg_co2e": 774.72,
                        "basis": "estimated"
                      }
                    ]
                  },
                  "mode_shift_available": false,
                  "mode_shifts": [],
                  "engagement": [
                    {
                      "external_id": "SUP-BR-0012",
                      "name": "Cooperativa Serra Alta",
                      "country": "BR",
                      "kg_co2e": 26900,
                      "share_of_footprint_pct": 100,
                      "cumulative_share_pct": 100,
                      "passport_id": null
                    }
                  ],
                  "supplier_governance_flags": [],
                  "methodology": [
                    "Reporting period: Calendar year 2025 (2025-01-01 to 2025-12-31), by purchase order date. Cancelled orders are excluded; orders with no date are reported and not counted.",
                    "A screening estimate from published averages, not a measurement."
                  ],
                  "factor_sets": [
                    {
                      "id": "0d3e2f1a-4b5c-4d6e-8f70-1a2b3c4d5e6f",
                      "key": "supply-chain-ghg-ef-1.4.0",
                      "publisher": "Cornerstone Sustainability Data Initiative (W. Ingwersen, B. Young)",
                      "title": "Supply Chain Greenhouse Gas Emission Factors for U.S. Commodities",
                      "version": "1.4.0",
                      "published_on": "2025-10-14",
                      "licence": "Creative Commons Attribution 4.0 International (CC BY 4.0)",
                      "licence_url": "https://creativecommons.org/licenses/by/4.0/",
                      "attribution": "Ingwersen, W. and Young, B. (2025). Supply Chain Greenhouse Gas Emission Factors for U.S. Commodities v1.4.0. Cornerstone Sustainability Data Initiative. Zenodo. https://doi.org/10.5281/zenodo.17202747. Licensed under CC BY 4.0; values used unmodified.",
                      "source_url": "https://zenodo.org/api/records/17202747/files/SupplyChainGHGEmissionFactorsv1.4.0.xlsx/content",
                      "file_sha256": "e47f19ba7330d4adfb77bd4663a2964af1c7b77197a74ea17a76434c9434f6b2",
                      "method_notes": null,
                      "currency_year": 2024
                    }
                  ],
                  "factors_used": [
                    {
                      "factor_id": "4e5f6a7b-8c9d-4e0f-a1b2-c3d4e5f6a7b8",
                      "set_id": "0d3e2f1a-4b5c-4d6e-8f70-1a2b3c4d5e6f",
                      "kind": "spend_per_usd",
                      "class_key": "311920",
                      "variant": "with_margins",
                      "title": "Coffee and Tea Manufacturing",
                      "value": 0.269,
                      "unit": "kg CO2e/2024 USD, purchaser price",
                      "boundary": "US supply chain, cradle to purchaser; purchaser price including transport, wholesale and retail margins",
                      "luc_value": null,
                      "kg_co2e": 26900,
                      "lines": 12
                    }
                  ],
                  "settings": {
                    "fiscal_year_start_month": 1
                  },
                  "latest_snapshot": null,
                  "duration_ms": 412,
                  "supplied_not_applied": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "esg",
        "x-writes": false
      }
    },
    "/v1/inventory/esg_footprint/export": {
      "get": {
        "operationId": "exportEsgFootprint",
        "summary": "The footprint of a period as a CSV or a print-ready HTML report, in `content`",
        "description": "Key scope: read (or execute). Module: esg.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            },
            "description": "A calendar year"
          },
          {
            "name": "fiscal_year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            },
            "description": "The account's fiscal year, named by the year it ends"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Custom period start, with to"
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Custom period end, inclusive"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "html"
              ],
              "default": "csv"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "$ref": "#/components/schemas/EsgPeriod"
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "csv",
                        "html"
                      ]
                    },
                    "filename": {
                      "type": "string"
                    },
                    "content_type": {
                      "type": "string"
                    },
                    "content": {
                      "type": "string",
                      "description": "The CSV, or a self-contained HTML report to print"
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "period",
                    "format",
                    "filename",
                    "content_type",
                    "content",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "8d7c6b5a-4f3e-4d2c-9b1a-0f9e8d7c6b5a",
                  "period": {
                    "start": "2025-01-01",
                    "end": "2025-12-31",
                    "label": "Calendar year 2025",
                    "kind": "calendar_year"
                  },
                  "format": "csv",
                  "filename": "footprint-2025-01-01-2025-12-31.csv",
                  "content_type": "text/csv; charset=utf-8",
                  "content": "Sustainability footprint,Calendar year 2025,2025-01-01,2025-12-31 (first line; the rows follow, one per line)",
                  "duration_ms": 398
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "esg",
        "x-writes": false
      }
    },
    "/v1/inventory/esg_footprint/lot": {
      "get": {
        "operationId": "getLotFootprint",
        "summary": "Footprint per kg of an output lot from its genealogy: bought inputs, roasting energy and packaging as stages",
        "description": "Key scope: read (or execute). Module: esg.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "lot",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Lot external id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "lot": {
                      "type": "object",
                      "properties": {
                        "external_id": {
                          "type": "string"
                        },
                        "lot_code": {
                          "type": "string"
                        },
                        "item": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "origin": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "external_id",
                        "lot_code",
                        "item",
                        "description",
                        "origin"
                      ]
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "kg_co2e_per_kg": {
                          "type": "number"
                        },
                        "luc_kg_co2e_per_kg": {
                          "type": "number"
                        },
                        "complete": {
                          "type": "boolean",
                          "description": "Every stage computed"
                        },
                        "stages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "stage": {
                                "type": "string"
                              },
                              "kg_co2e_per_kg": {
                                "type": "number"
                              },
                              "rows": {
                                "type": "integer"
                              },
                              "computed": {
                                "type": "integer"
                              },
                              "not_provided": {
                                "type": "integer"
                              },
                              "no_factor": {
                                "type": "integer"
                              },
                              "unit_not_mass": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "stage",
                              "kg_co2e_per_kg",
                              "rows",
                              "computed",
                              "not_provided",
                              "no_factor",
                              "unit_not_mass"
                            ]
                          }
                        },
                        "by_origin": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "origin": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kg_input_per_kg": {
                                "type": "number"
                              },
                              "kg_co2e_per_kg": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "origin",
                              "kg_input_per_kg",
                              "kg_co2e_per_kg"
                            ]
                          }
                        }
                      },
                      "required": [
                        "kg_co2e_per_kg",
                        "luc_kg_co2e_per_kg",
                        "complete",
                        "stages",
                        "by_origin"
                      ]
                    },
                    "stages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "stage": {
                            "type": "string",
                            "enum": [
                              "input",
                              "roasting",
                              "packaging"
                            ]
                          },
                          "lot_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "item_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "origin_country": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "transformation_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "kg_per_kg_output": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "kg of this input (or of the roast step's output) per kg of the lot"
                          },
                          "method": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "factor_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "factor_value": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "factor_unit": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kg_co2e_per_kg_output": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "luc_kg_co2e_per_kg_output": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "computed",
                              "no_factor",
                              "not_provided",
                              "unit_not_mass"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lot": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "item": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "item_description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "factor": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "title": {
                                "type": "string"
                              },
                              "boundary": {
                                "type": "string"
                              },
                              "set": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "title",
                              "boundary",
                              "set"
                            ]
                          }
                        },
                        "required": [
                          "stage",
                          "lot_id",
                          "item_id",
                          "origin_country",
                          "transformation_id",
                          "kg_per_kg_output",
                          "method",
                          "factor_id",
                          "factor_value",
                          "factor_unit",
                          "kg_co2e_per_kg_output",
                          "luc_kg_co2e_per_kg_output",
                          "status",
                          "note",
                          "lot",
                          "item",
                          "item_description",
                          "factor"
                        ]
                      }
                    },
                    "factor_sets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EmissionFactorSet"
                      }
                    },
                    "method": {
                      "type": "string"
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "lot",
                    "summary",
                    "stages",
                    "factor_sets",
                    "method",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "6e5d4c3b-2a1f-4e0d-8c9b-7a6f5e4d3c2b",
                  "lot": {
                    "external_id": "RB-2025-0412",
                    "lot_code": "RB-2025-0412",
                    "item": "MAT-00000040",
                    "description": "Espresso roast, 1 kg",
                    "origin": null
                  },
                  "summary": {
                    "kg_co2e_per_kg": 5.04,
                    "luc_kg_co2e_per_kg": 0.912,
                    "complete": false,
                    "stages": [
                      {
                        "stage": "input",
                        "kg_co2e_per_kg": 5.04,
                        "rows": 1,
                        "computed": 1,
                        "not_provided": 0,
                        "no_factor": 0,
                        "unit_not_mass": 0
                      },
                      {
                        "stage": "roasting",
                        "kg_co2e_per_kg": 0,
                        "rows": 1,
                        "computed": 0,
                        "not_provided": 1,
                        "no_factor": 0,
                        "unit_not_mass": 0
                      },
                      {
                        "stage": "packaging",
                        "kg_co2e_per_kg": 0,
                        "rows": 1,
                        "computed": 0,
                        "not_provided": 1,
                        "no_factor": 0,
                        "unit_not_mass": 0
                      }
                    ],
                    "by_origin": [
                      {
                        "origin": "BR",
                        "kg_input_per_kg": 1.2,
                        "kg_co2e_per_kg": 5.04
                      }
                    ]
                  },
                  "stages": [
                    {
                      "lot_id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d",
                      "item_id": "9c8b7a6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
                      "origin_country": "BR",
                      "transformation_id": null,
                      "kg_per_kg_output": 1.2,
                      "method": "mass",
                      "factor_id": "3b4c5d6e-7f80-4a91-8b2c-d3e4f5a6b7c8",
                      "factor_value": 4.2,
                      "factor_unit": "kg CO2e per kg",
                      "kg_co2e_per_kg_output": 5.04,
                      "luc_kg_co2e_per_kg_output": 0.912,
                      "status": "computed",
                      "note": null,
                      "lot": "GL-2025-0098",
                      "item": "MAT-00000031",
                      "item_description": "Green coffee, washed arabica",
                      "factor": {
                        "title": "Account mapping: green coffee",
                        "boundary": "Per kg as listed by the factor set",
                        "set": "agribalyse-3.2-synthese"
                      },
                      "stage": "input"
                    },
                    {
                      "lot_id": null,
                      "item_id": null,
                      "origin_country": null,
                      "transformation_id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
                      "kg_per_kg_output": 1,
                      "method": null,
                      "factor_id": null,
                      "factor_value": null,
                      "factor_unit": "kg CO2e per kg of site output",
                      "kg_co2e_per_kg_output": null,
                      "luc_kg_co2e_per_kg_output": null,
                      "status": "not_provided",
                      "note": "No energy entered for this site and date",
                      "lot": null,
                      "item": null,
                      "item_description": null,
                      "factor": null,
                      "stage": "roasting"
                    },
                    {
                      "lot_id": null,
                      "item_id": "1f2e3d4c-5b6a-4978-8a9b-0c1d2e3f4a5b",
                      "origin_country": null,
                      "transformation_id": null,
                      "kg_per_kg_output": null,
                      "method": null,
                      "factor_id": null,
                      "factor_value": null,
                      "factor_unit": null,
                      "kg_co2e_per_kg_output": null,
                      "luc_kg_co2e_per_kg_output": null,
                      "status": "not_provided",
                      "note": "No packaging entered for this item",
                      "lot": null,
                      "item": null,
                      "item_description": null,
                      "factor": null,
                      "stage": "packaging"
                    }
                  ],
                  "factor_sets": [
                    {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "key": "agribalyse-3.2-synthese",
                      "publisher": "ADEME (Agence de la transition écologique)",
                      "title": "AGRIBALYSE - Synthèse",
                      "version": "3.2",
                      "published_on": "2025-02-27",
                      "licence": "Licence Ouverte / Open Licence 2.0 (Etalab)",
                      "licence_url": "https://www.etalab.gouv.fr/licence-ouverte-open-licence",
                      "attribution": "Source: ADEME, AGRIBALYSE® v3.2, synthèse (data.ademe.fr, jeu de données agribalyse-31-synthese, données mises à jour le 2025-02-27). Licence Ouverte / Open Licence 2.0.",
                      "source_url": "https://data.ademe.fr/data-fair/api/v1/datasets/agribalyse-31-synthese/raw",
                      "file_sha256": "0c85fdf1a257e27e7ea771789a2b973b8c2fe946aa2bc43a1fcc906c2f565cc4",
                      "method_notes": null,
                      "currency_year": null
                    }
                  ],
                  "method": "kg of each bought input per kg of this lot from the lot genealogy, times the input's factor (the account's own first, then its mass mapping). Roasting energy and packaging appear only when the account entered them; otherwise they are listed as not provided.",
                  "duration_ms": 87
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "esg",
        "x-writes": false
      }
    },
    "/v1/inventory/expiry_actions": {
      "get": {
        "operationId": "listExpiryActions",
        "summary": "Transfers and markdowns for stock about to expire. Read-only; `planning` in the answer says whether it is the latest stored result or one made for this request's settings. The same proposals are listed as proposed recommendations",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `actions`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryExpiryAction"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "actions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryExpiryAction"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging; absent when the answer is read from stored results"
                    },
                    "compliance": {
                      "$ref": "#/components/schemas/PlanningComplianceExclusions"
                    },
                    "planning": {
                      "$ref": "#/components/schemas/InventoryResultSource"
                    },
                    "note": {
                      "type": "string",
                      "description": "Present instead of the other fields when the organization has no lots with expiry dates"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "actions",
                    "count",
                    "planning",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "ff46a8a5-ef15-4e6e-a54e-f57c36ef4bf2",
                  "data_as_of": "2026-11-21T04:02:11.000+00:00",
                  "demand_source": {
                    "source": "daily_demand",
                    "history_complete": true,
                    "history_as_of": "2026-11-21T04:10:00.000+00:00",
                    "fallback_reason": null
                  },
                  "stale": false,
                  "count": 1,
                  "total": 1,
                  "has_more": false,
                  "actions": [
                    {
                      "type": "transfer",
                      "itemExternalId": "MAT-00000311",
                      "fromLocationExternalId": "1004",
                      "toLocationExternalId": "1010",
                      "quantity": 48,
                      "rescuedValue": 1296,
                      "priority": 74,
                      "rationale": {
                        "reason": "Store 1010 sells this item fast enough to clear the lot before it expires",
                        "days_to_expiry": 19,
                        "transfer_window_days": 12,
                        "unmovable_units": 0
                      }
                    }
                  ],
                  "compliance": {
                    "mode": "flag",
                    "excluded": 0,
                    "excluded_needs": []
                  },
                  "planning": {
                    "source": "on_request",
                    "reason": "no_stored_result"
                  },
                  "duration_ms": 72,
                  "notes": [
                    "Transfers move soon-to-expire stock to locations that can sell it before expiry; markdowns clear what can't be moved in time."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "type": "transfer",
                      "itemExternalId": "MAT-00000311",
                      "fromLocationExternalId": "1004",
                      "toLocationExternalId": "1010",
                      "quantity": 48,
                      "rescuedValue": 1296,
                      "priority": 74,
                      "rationale": {
                        "reason": "Store 1010 sells this item fast enough to clear the lot before it expires",
                        "days_to_expiry": 19,
                        "transfer_window_days": 12,
                        "unmovable_units": 0
                      }
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "actions"
        }
      }
    },
    "/v1/inventory/expiry_risks": {
      "get": {
        "operationId": "listExpiryRisks",
        "summary": "Lots projected to expire unsold (FEFO)",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `at_risk`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryExpiryRisk"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "at_risk": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryExpiryRisk"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging"
                    },
                    "note": {
                      "type": "string",
                      "description": "Present instead of the other fields when the organization has no lots"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "at_risk",
                    "count",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "952d1a0d-1745-42a2-843d-409d48e548b4",
                  "window_days": 90,
                  "data_as_of": "2026-11-21T04:02:11.000+00:00",
                  "demand_source": {
                    "source": "daily_demand",
                    "history_complete": true,
                    "history_as_of": "2026-11-21T04:10:00.000+00:00",
                    "fallback_reason": null
                  },
                  "stale": false,
                  "count": 1,
                  "total": 1,
                  "has_more": false,
                  "at_risk": [
                    {
                      "item": "MAT-00000311",
                      "description": "Hand cream 75 ml",
                      "location": "1004",
                      "mean_daily_demand": 1.4,
                      "total_at_risk_units": 21,
                      "total_at_risk_value": 567,
                      "lots": [
                        {
                          "lotCode": "LOT-2026-0412",
                          "expiryDate": "2026-12-10",
                          "daysToExpiry": 19,
                          "onHand": 48,
                          "projectedSold": 27,
                          "atRiskUnits": 21,
                          "atRiskValue": 567,
                          "status": "at_risk"
                        }
                      ]
                    }
                  ],
                  "duration_ms": 55,
                  "notes": [
                    "FEFO: demand consumes earliest-expiring lots first; at-risk = units projected to expire unsold before their date."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000311",
                      "description": "Hand cream 75 ml",
                      "location": "1004",
                      "mean_daily_demand": 1.4,
                      "total_at_risk_units": 21,
                      "total_at_risk_value": 567,
                      "lots": [
                        {
                          "lotCode": "LOT-2026-0412",
                          "expiryDate": "2026-12-10",
                          "daysToExpiry": 19,
                          "onHand": 48,
                          "projectedSold": 27,
                          "atRiskUnits": 21,
                          "atRiskValue": 567,
                          "status": "at_risk"
                        }
                      ]
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "at_risk"
        }
      }
    },
    "/v1/inventory/forecast_accuracy": {
      "get": {
        "operationId": "listForecastAccuracy",
        "summary": "Forecast accuracy measured on your own sales history: ours against naive and seasonal naive, with error, bias, scaled error and sample size per level",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `rows`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "item_location",
                "item",
                "category",
                "location",
                "location_type",
                "org"
              ],
              "default": "item"
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "summary",
                "weekly"
              ],
              "default": "summary"
            },
            "description": "weekly: one row per origin week (levels category, location_type, org)"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First origin week (weekly only)"
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last origin week (weekly only)"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Item external id (levels item, item_location)"
          },
          {
            "name": "location",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Location external id (levels location, item_location)"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ok",
                "insufficient_history",
                "no_actuals"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "worst",
                "value_add",
                "bias",
                "volume",
                "name",
                "period"
              ]
            },
            "description": "Default worst (summary) or period (weekly)"
          },
          {
            "name": "evaluation_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "An earlier evaluation, by the `id` of `evaluation` (default: the newest)"
          },
          {
            "name": "run_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Deprecated: use evaluation_id",
            "deprecated": true
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ForecastAccuracyRow"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ForecastAccuracyRow"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "no_results",
                        "no_history",
                        "insufficient_history",
                        "ok"
                      ],
                      "description": "no_results: accuracy has not been measured on this organization yet"
                    },
                    "message": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Why there are no numbers; null when status is ok"
                    },
                    "evaluation": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/ForecastEvaluation"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The measurement the rows come from; null when status is no_results"
                    },
                    "overall": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/ForecastAccuracyRow"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The whole organization's row; null unless status is ok"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "level": {
                          "type": "string",
                          "enum": [
                            "item_location",
                            "item",
                            "category",
                            "location",
                            "location_type",
                            "org"
                          ]
                        },
                        "period": {
                          "type": "string",
                          "enum": [
                            "summary",
                            "weekly"
                          ]
                        },
                        "from": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date"
                        },
                        "to": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date"
                        },
                        "item": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "location": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "ok",
                            "insufficient_history",
                            "no_actuals",
                            null
                          ]
                        },
                        "sort": {
                          "type": "string",
                          "enum": [
                            "worst",
                            "value_add",
                            "bias",
                            "volume",
                            "name",
                            "period"
                          ]
                        },
                        "evaluation_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "level",
                        "period",
                        "from",
                        "to",
                        "item",
                        "location",
                        "status",
                        "sort",
                        "evaluation_id"
                      ],
                      "description": "The filters as used"
                    },
                    "page": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "total": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Rows matching the filters"
                        },
                        "has_more": {
                          "type": "boolean",
                          "deprecated": true,
                          "description": "Deprecated: the same as the top-level has_more"
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "deprecated": true,
                          "description": "Deprecated: the same as the top-level next_cursor"
                        }
                      },
                      "required": [
                        "limit",
                        "total",
                        "has_more",
                        "next_cursor"
                      ]
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "rows",
                    "status",
                    "message",
                    "evaluation",
                    "overall",
                    "filters",
                    "page",
                    "data_as_of",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "f59d1764-d6de-40a1-9e7e-69526a6910cf",
                  "status": "ok",
                  "message": null,
                  "overall": {
                    "level": "org",
                    "node": "org",
                    "label": "Whole organization",
                    "item_id": null,
                    "location_id": null,
                    "period_start": null,
                    "status": "ok",
                    "reason": null,
                    "sample": {
                      "leaves": 4050,
                      "origins": 26,
                      "points": 52,
                      "actual_total": 412600,
                      "history_weeks": 61
                    },
                    "ours": {
                      "mae": 6.2,
                      "rmse": 8.4,
                      "bias": -0.6,
                      "bias_pct": -1.7,
                      "wape_pct": 17.5,
                      "mase": 0.81,
                      "rmsse": 0.84,
                      "mae_by_horizon": [
                        5.58,
                        6.82
                      ],
                      "bias_by_horizon": [
                        -0.6,
                        -0.6
                      ],
                      "methods": {
                        "smoothed_weekday": 22,
                        "intermittent": 4
                      }
                    },
                    "naive": {
                      "mae": 7.9,
                      "rmse": 10,
                      "bias": 0.3,
                      "bias_pct": 0.8,
                      "wape_pct": 22.3,
                      "mase": 1,
                      "rmsse": 1,
                      "mae_by_horizon": [
                        7.11,
                        8.69
                      ],
                      "bias_by_horizon": [
                        0.3,
                        0.3
                      ]
                    },
                    "seasonal_naive": {
                      "mae": 8.3,
                      "rmse": 10.9,
                      "bias": 1.1,
                      "bias_pct": 3.1,
                      "wape_pct": 23.4,
                      "mase": 1.05,
                      "rmsse": 1.09,
                      "mae_by_horizon": [
                        7.47,
                        9.13
                      ],
                      "bias_by_horizon": [
                        1.1,
                        1.1
                      ],
                      "seasonal_share": 0.42
                    },
                    "value_add": {
                      "rmsse_ratio": 0.84,
                      "wape_points": 4.8,
                      "beats_naive": true
                    }
                  },
                  "filters": {
                    "level": "item",
                    "period": "summary",
                    "from": null,
                    "to": null,
                    "item": null,
                    "location": null,
                    "status": null,
                    "sort": "worst",
                    "evaluation_id": null
                  },
                  "rows": [
                    {
                      "level": "item",
                      "node": "MAT-00000029",
                      "label": "Handbags - Style 00000029",
                      "item_id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                      "location_id": null,
                      "period_start": null,
                      "status": "ok",
                      "reason": null,
                      "sample": {
                        "leaves": 12,
                        "origins": 26,
                        "points": 52,
                        "actual_total": 1840,
                        "history_weeks": 61
                      },
                      "ours": {
                        "mae": 6.2,
                        "rmse": 8.4,
                        "bias": -0.6,
                        "bias_pct": -1.7,
                        "wape_pct": 17.5,
                        "mase": 0.81,
                        "rmsse": 0.84,
                        "mae_by_horizon": [
                          5.58,
                          6.82
                        ],
                        "bias_by_horizon": [
                          -0.6,
                          -0.6
                        ],
                        "methods": {
                          "smoothed_weekday": 22,
                          "intermittent": 4
                        }
                      },
                      "naive": {
                        "mae": 7.9,
                        "rmse": 10,
                        "bias": 0.3,
                        "bias_pct": 0.8,
                        "wape_pct": 22.3,
                        "mase": 1,
                        "rmsse": 1,
                        "mae_by_horizon": [
                          7.11,
                          8.69
                        ],
                        "bias_by_horizon": [
                          0.3,
                          0.3
                        ]
                      },
                      "seasonal_naive": {
                        "mae": 8.3,
                        "rmse": 10.9,
                        "bias": 1.1,
                        "bias_pct": 3.1,
                        "wape_pct": 23.4,
                        "mase": 1.05,
                        "rmsse": 1.09,
                        "mae_by_horizon": [
                          7.47,
                          9.13
                        ],
                        "bias_by_horizon": [
                          1.1,
                          1.1
                        ],
                        "seasonal_share": 0.42
                      },
                      "value_add": {
                        "rmsse_ratio": 0.84,
                        "wape_points": 4.8,
                        "beats_naive": true
                      }
                    }
                  ],
                  "page": {
                    "limit": 100,
                    "total": 405,
                    "has_more": true,
                    "next_cursor": "example-token"
                  },
                  "data_as_of": "2026-11-16T02:58:40.000+00:00",
                  "notes": [
                    "For each past week, our forecast and two benchmarks (naive: the last week; seasonal naive: the same week a year earlier) are made from the sales before it and compared with what sold over the next horizon_weeks."
                  ],
                  "duration_ms": 4,
                  "object": "list",
                  "data": [
                    {
                      "level": "item",
                      "node": "MAT-00000029",
                      "label": "Handbags - Style 00000029",
                      "item_id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                      "location_id": null,
                      "period_start": null,
                      "status": "ok",
                      "reason": null,
                      "sample": {
                        "leaves": 12,
                        "origins": 26,
                        "points": 52,
                        "actual_total": 1840,
                        "history_weeks": 61
                      },
                      "ours": {
                        "mae": 6.2,
                        "rmse": 8.4,
                        "bias": -0.6,
                        "bias_pct": -1.7,
                        "wape_pct": 17.5,
                        "mase": 0.81,
                        "rmsse": 0.84,
                        "mae_by_horizon": [
                          5.58,
                          6.82
                        ],
                        "bias_by_horizon": [
                          -0.6,
                          -0.6
                        ],
                        "methods": {
                          "smoothed_weekday": 22,
                          "intermittent": 4
                        }
                      },
                      "naive": {
                        "mae": 7.9,
                        "rmse": 10,
                        "bias": 0.3,
                        "bias_pct": 0.8,
                        "wape_pct": 22.3,
                        "mase": 1,
                        "rmsse": 1,
                        "mae_by_horizon": [
                          7.11,
                          8.69
                        ],
                        "bias_by_horizon": [
                          0.3,
                          0.3
                        ]
                      },
                      "seasonal_naive": {
                        "mae": 8.3,
                        "rmse": 10.9,
                        "bias": 1.1,
                        "bias_pct": 3.1,
                        "wape_pct": 23.4,
                        "mase": 1.05,
                        "rmsse": 1.09,
                        "mae_by_horizon": [
                          7.47,
                          9.13
                        ],
                        "bias_by_horizon": [
                          1.1,
                          1.1
                        ],
                        "seasonal_share": 0.42
                      },
                      "value_add": {
                        "rmsse_ratio": 0.84,
                        "wape_points": 4.8,
                        "beats_naive": true
                      }
                    }
                  ],
                  "has_more": true,
                  "next_cursor": "example-token",
                  "evaluation": {
                    "id": "5d2c8a14-7b3e-4f19-a6c0-9e1b2d3f4a55",
                    "computed_at": "2026-11-16T03:40:12.000+00:00",
                    "age_hours": 127.3,
                    "stale": false,
                    "history": {
                      "from": "2025-09-22",
                      "to": "2026-11-15",
                      "weeks": 60,
                      "capped": false,
                      "calendar_from": "2025-05-19",
                      "calendar_weeks": 78
                    },
                    "origins": {
                      "count": 26,
                      "from": "2026-05-18",
                      "to": "2026-11-09"
                    },
                    "horizon_weeks": 2,
                    "min_history_weeks": 13,
                    "min_scored_origins": 8,
                    "pairs": {
                      "total": 4050,
                      "scored": 3312,
                      "insufficient_history": 738
                    },
                    "items": 405,
                    "levels": [
                      "item_location",
                      "item",
                      "category",
                      "location",
                      "location_type",
                      "org"
                    ],
                    "levels_skipped": {},
                    "method": {
                      "forecast": "A statistical forecast per item and location, fitted on the sales before each week and summed into weeks",
                      "benchmarks": [
                        "naive",
                        "seasonal_naive"
                      ],
                      "scaled_error": "rmsse",
                      "demand_history": "daily_demand"
                    },
                    "data_as_of": "2026-11-16T02:58:40.000+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "rows"
        }
      }
    },
    "/v1/inventory/forecasts": {
      "get": {
        "operationId": "listForecasts",
        "summary": "Deterministic demand forecast per item and location, with calendar demand drivers. Read-only; `planning` in the answer says whether it is the latest stored result or one made for this request's settings",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `forecasts`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "horizon_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 7,
              "maximum": 90,
              "default": 30
            }
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryForecast"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "forecasts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryForecast"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "horizon_days": {
                      "type": "integer"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging; absent when the answer is read from stored results"
                    },
                    "demand_drivers_in_horizon": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "event_type": {
                            "type": "string"
                          },
                          "severity": {
                            "type": "integer",
                            "description": "1 (minor) to 5 (severe)"
                          },
                          "country_codes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "starts_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "ends_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "title",
                          "event_type",
                          "severity",
                          "country_codes",
                          "starts_at",
                          "ends_at"
                        ]
                      },
                      "description": "Demand-moving events that start before the horizon ends: context, never applied to the forecast"
                    },
                    "planning": {
                      "$ref": "#/components/schemas/InventoryResultSource"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "forecasts",
                    "window_days",
                    "horizon_days",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "demand_drivers_in_horizon",
                    "planning",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "bc54e272-dff5-498a-af1a-a6a3fc7d8df5",
                  "window_days": 90,
                  "horizon_days": 30,
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 100,
                  "total": 4050,
                  "has_more": true,
                  "forecasts": [
                    {
                      "item": "MAT-00000029",
                      "description": "Handbags - Style 00000029",
                      "location": "1003",
                      "classification": "intermittent",
                      "method": "intermittent",
                      "history_mean_daily": 2.8,
                      "forecast_daily_rate": 22.4713,
                      "forecast_horizon_total": 674.14,
                      "in_sample_mae": null,
                      "day_of_week_indices": null
                    }
                  ],
                  "demand_drivers_in_horizon": [
                    {
                      "title": "Las Vegas Grand Prix 2026",
                      "event_type": "sports_event",
                      "severity": 2,
                      "country_codes": [
                        "US"
                      ],
                      "starts_at": "2026-11-19T00:00:00+00:00",
                      "ends_at": "2026-11-21T23:59:59+00:00"
                    }
                  ],
                  "planning": {
                    "source": "on_request",
                    "reason": "no_stored_result"
                  },
                  "duration_ms": 192,
                  "notes": [
                    "Forecasts are statistical and the same for the same history: smoothed by weekday for steady and variable demand (smoothed_weekday), an intermittent-demand method for sparse demand (intermittent)."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000029",
                      "description": "Handbags - Style 00000029",
                      "location": "1003",
                      "classification": "intermittent",
                      "method": "intermittent",
                      "history_mean_daily": 2.8,
                      "forecast_daily_rate": 22.4713,
                      "forecast_horizon_total": 674.14,
                      "in_sample_mae": null,
                      "day_of_week_indices": null
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "forecasts"
        }
      }
    },
    "/v1/inventory/markdown_candidates": {
      "get": {
        "operationId": "listMarkdownCandidates",
        "summary": "Overhang markdown suggestions. Read-only; `planning` in the answer says whether it is the latest stored result or one made for this request's settings. The same proposals are listed as proposed recommendations",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `candidates`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "season_end",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "1-365 days ahead; default 56 days"
          },
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MarkdownCandidate"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "candidates": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MarkdownCandidate"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "season_days_remaining": {
                      "type": "integer"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging; absent when the answer is read from stored results"
                    },
                    "planning": {
                      "$ref": "#/components/schemas/InventoryResultSource"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "candidates",
                    "window_days",
                    "season_days_remaining",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "planning",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "52f18028-7f16-47c9-88a2-b7f2d17881a3",
                  "window_days": 90,
                  "season_days_remaining": 56,
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 100,
                  "total": 713,
                  "has_more": true,
                  "candidates": [
                    {
                      "item": "MAT-00000711",
                      "description": "Footwear - Style 00000711",
                      "location": "1018",
                      "on_hand": 39,
                      "last_selling_price": 892.3,
                      "projected_sales": 0.62,
                      "projected_overhang_units": 38.38,
                      "overhang_ratio": 0.98,
                      "weeks_of_stock": 501.93,
                      "suggested_markdown_pct": 40,
                      "overhang_value_at_cost": 18327.22,
                      "reason": "At the current rate ~1 of 39 units sell before season end, leaving ~38 unsold (98% overhang)."
                    }
                  ],
                  "planning": {
                    "source": "on_request",
                    "reason": "no_stored_result"
                  },
                  "duration_ms": 201,
                  "notes": [
                    "Stock-overhang clearance suggestions: items that will not sell through before season end."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000711",
                      "description": "Footwear - Style 00000711",
                      "location": "1018",
                      "on_hand": 39,
                      "last_selling_price": 892.3,
                      "projected_sales": 0.62,
                      "projected_overhang_units": 38.38,
                      "overhang_ratio": 0.98,
                      "weeks_of_stock": 501.93,
                      "suggested_markdown_pct": 40,
                      "overhang_value_at_cost": 18327.22,
                      "reason": "At the current rate ~1 of 39 units sell before season end, leaving ~38 unsold (98% overhang)."
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "candidates"
        }
      }
    },
    "/v1/inventory/merchandise_plan": {
      "get": {
        "operationId": "getMerchandisePlan",
        "summary": "Category sales, margin, GMROI, weeks of supply and open-to-buy",
        "description": "Key scope: read (or execute).",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Location external id"
          },
          {
            "name": "store",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Deprecated: use location",
            "deprecated": true
          },
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "horizon_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 7,
              "maximum": 90,
              "default": 30
            }
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "forecast_horizon_days": {
                      "type": "integer"
                    },
                    "store": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The store filter (location external id); null for the whole organization"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Categories"
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MerchandisePlanCategory"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "window_days",
                    "forecast_horizon_days",
                    "store",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "categories",
                    "duration_ms",
                    "notes",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "a02282be-9b81-4032-914c-2e3d42514075",
                  "window_days": 90,
                  "forecast_horizon_days": 30,
                  "store": null,
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 7,
                  "categories": [
                    {
                      "category": "SMALL LEATHER GOODS",
                      "window_units_sold": 16136,
                      "window_revenue": 8724778.87,
                      "window_gross_margin": 5244864.44,
                      "margin_pct": 60.1,
                      "on_hand_units": 16397,
                      "inventory_value_at_cost": 4369268.02,
                      "window_gmroi": 1.2,
                      "gmroi_annualized": 4.87,
                      "weeks_of_supply": 13.07,
                      "plan_signal": "buy",
                      "plan_reason": "short styles need 6,589 more units than on hand + inbound",
                      "inbound_units": 1861,
                      "forecast_units": 11320,
                      "open_to_buy_units": 6589,
                      "open_to_buy_value_at_cost": 1321299.43
                    }
                  ],
                  "duration_ms": 76,
                  "notes": [
                    "open_to_buy = per item, forecast demand over the horizon minus (on hand + inbound), floored at zero; summed per category (one style's ove..."
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false
      }
    },
    "/v1/inventory/new_product_forecasts": {
      "get": {
        "operationId": "listNewProductForecasts",
        "summary": "Cold-start estimates from same-category items",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `forecasts`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "horizon_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 7,
              "maximum": 90,
              "default": 30
            }
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NewProductForecast"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "forecasts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NewProductForecast"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "horizon_days": {
                      "type": "integer"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "forecasts",
                    "window_days",
                    "horizon_days",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "total",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "72accf98-b5bf-431f-b9e5-db7a7fda5551",
                  "window_days": 90,
                  "horizon_days": 30,
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 100,
                  "total": 737,
                  "has_more": true,
                  "forecasts": [
                    {
                      "item": "MAT-00000411",
                      "description": "Small Leather Goods - Style 00000411",
                      "category": "SMALL LEATHER GOODS",
                      "own_history_days": 5,
                      "method": "like_item_category_mean",
                      "estimatedDailyRate": 8.4067,
                      "horizonTotal": 252.2,
                      "basisCount": 16,
                      "basisItems": [
                        "MAT-00000061"
                      ],
                      "confidence": "medium"
                    }
                  ],
                  "duration_ms": 80,
                  "notes": [
                    "Estimates for items with under 14 days of their own demand, from the average daily rate of similar items in the same category."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000411",
                      "description": "Small Leather Goods - Style 00000411",
                      "category": "SMALL LEATHER GOODS",
                      "own_history_days": 5,
                      "method": "like_item_category_mean",
                      "estimatedDailyRate": 8.4067,
                      "horizonTotal": 252.2,
                      "basisCount": 16,
                      "basisItems": [
                        "MAT-00000061"
                      ],
                      "confidence": "medium"
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "forecasts"
        }
      }
    },
    "/v1/inventory/purchase_order_risks": {
      "get": {
        "operationId": "listPurchaseOrderRisks",
        "summary": "Risk score and action per open purchase order; days until expected follows the supplier network's predicted arrival when there is one. Read-only",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `purchase_orders`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PurchaseOrderRisk"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "purchase_orders": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PurchaseOrderRisk"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging"
                    },
                    "planning": {
                      "$ref": "#/components/schemas/InventoryResultSource"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "purchase_orders",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "total",
                    "planning",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "c1c6ac4a-2680-48e8-9113-12de3960088b",
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 32,
                  "total": 32,
                  "has_more": false,
                  "purchase_orders": [
                    {
                      "purchase_order": "PO-0000091",
                      "supplier": {
                        "external_id": "VEND-000131",
                        "name": "Guangzhou Footwear Mfg 0131",
                        "country_code": "MX"
                      },
                      "status": "open",
                      "expected_delivery_date": "2026-11-09",
                      "days_until_expected": -12.5,
                      "risk_score": 77.5,
                      "recommended_action": "expedite",
                      "factors": [
                        {
                          "factor": "overdue",
                          "points": 52.5,
                          "detail": "12.5 days past expected delivery"
                        }
                      ],
                      "critical_item": null,
                      "critical_location": null
                    }
                  ],
                  "planning": {
                    "source": "on_request",
                    "reason": "not_stored"
                  },
                  "duration_ms": 70,
                  "notes": [
                    "risk_score is the same for the same data: it rises when the order is overdue or has no date, when a disruption reaches its supplier and when the item is close to a stockout, and a little more for a supplier that has delivered late before, which raises the rank but never decides recommended_action."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "purchase_order": "PO-0000091",
                      "supplier": {
                        "external_id": "VEND-000131",
                        "name": "Guangzhou Footwear Mfg 0131",
                        "country_code": "MX"
                      },
                      "status": "open",
                      "expected_delivery_date": "2026-11-09",
                      "days_until_expected": -12.5,
                      "risk_score": 77.5,
                      "recommended_action": "expedite",
                      "factors": [
                        {
                          "factor": "overdue",
                          "points": 52.5,
                          "detail": "12.5 days past expected delivery"
                        }
                      ],
                      "critical_item": null,
                      "critical_location": null
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "purchase_orders"
        }
      }
    },
    "/v1/inventory/purchase_proposals": {
      "get": {
        "operationId": "listPurchaseProposals",
        "summary": "Network-level purchase proposals with a suggested supplier. Read-only; `planning` in the answer says whether it is the latest stored result or one made for this request's settings. The same proposals are listed as proposed recommendations",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `proposals`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "service_level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0.5,
              "maximum": 0.999
            },
            "description": "Applies to every item of this request; left out, each item and location plans on its own value in force (default 0.95)"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryPurchaseProposal"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "proposals": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryPurchaseProposal"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "service_level": {
                      "type": "number",
                      "description": "The request's service level, else the account-wide value in force"
                    },
                    "service_level_source": {
                      "type": "string",
                      "enum": [
                        "request",
                        "default",
                        "observed",
                        "stated"
                      ]
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging; absent when the answer is read from stored results"
                    },
                    "rules": {
                      "type": "object",
                      "properties": {
                        "proposals_on_observed_lead_time": {
                          "type": "integer",
                          "description": "Proposals planned on a lead time observed from receipts"
                        }
                      },
                      "required": [
                        "proposals_on_observed_lead_time"
                      ]
                    },
                    "supplier_updates_applied": {
                      "type": "integer",
                      "description": "Items whose inbound the supplier network changed"
                    },
                    "compliance": {
                      "$ref": "#/components/schemas/PlanningComplianceExclusions"
                    },
                    "planning": {
                      "$ref": "#/components/schemas/InventoryResultSource"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "proposals",
                    "window_days",
                    "service_level",
                    "service_level_source",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "rules",
                    "supplier_updates_applied",
                    "planning",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "17fa907e-33cf-4246-9f66-a104157f86a9",
                  "window_days": 90,
                  "service_level": 0.95,
                  "service_level_source": "default",
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 65,
                  "total": 65,
                  "has_more": false,
                  "rules": {
                    "proposals_on_observed_lead_time": 0
                  },
                  "proposals": [
                    {
                      "item": "MAT-00000026",
                      "description": "Handbags - Style 00000026",
                      "quantity": 2141,
                      "priority": 99.44,
                      "suggested_supplier": {
                        "external_id": "VEND-000022",
                        "name": "Phnom Penh Footwear Mfg 0022",
                        "country_code": "MX",
                        "lead_time_days": 52,
                        "disruption_affected": true
                      },
                      "rationale": {
                        "network_on_hand": 13,
                        "inbound_quantity": 0,
                        "network_position": 13,
                        "mean_daily_demand": 22.7333,
                        "lead_time_days": 52,
                        "safety_stock": 653.11,
                        "reorder_point": 1835.24,
                        "order_up_to_level": 2153.51,
                        "network_days_of_cover": 0.57,
                        "estimated_value": 959596.2,
                        "supplier_disruption_affected": true,
                        "alternate_suppliers": [],
                        "lead_time_source": "supplier_master",
                        "service_level": 0.95,
                        "review_period_days": 14,
                        "parameters": {
                          "inventory.service_level": {
                            "value": 0.95,
                            "origin": "default",
                            "scope": null,
                            "setBy": null,
                            "setAt": null
                          },
                          "inventory.review_period_days": {
                            "value": 14,
                            "origin": "default",
                            "scope": null,
                            "setBy": null,
                            "setAt": null
                          }
                        }
                      }
                    }
                  ],
                  "supplier_updates_applied": 2,
                  "compliance": {
                    "mode": "flag",
                    "excluded": 0,
                    "excluded_needs": []
                  },
                  "planning": {
                    "source": "on_request",
                    "reason": "no_stored_result"
                  },
                  "duration_ms": 107,
                  "notes": [
                    "Proposals fire only when the whole network (on-hand + inbound) sits below the reorder point — transfers cannot fix these."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000026",
                      "description": "Handbags - Style 00000026",
                      "quantity": 2141,
                      "priority": 99.44,
                      "suggested_supplier": {
                        "external_id": "VEND-000022",
                        "name": "Phnom Penh Footwear Mfg 0022",
                        "country_code": "MX",
                        "lead_time_days": 52,
                        "disruption_affected": true
                      },
                      "rationale": {
                        "network_on_hand": 13,
                        "inbound_quantity": 0,
                        "network_position": 13,
                        "mean_daily_demand": 22.7333,
                        "lead_time_days": 52,
                        "safety_stock": 653.11,
                        "reorder_point": 1835.24,
                        "order_up_to_level": 2153.51,
                        "network_days_of_cover": 0.57,
                        "estimated_value": 959596.2,
                        "supplier_disruption_affected": true,
                        "alternate_suppliers": [],
                        "lead_time_source": "supplier_master",
                        "service_level": 0.95,
                        "review_period_days": 14,
                        "parameters": {
                          "inventory.service_level": {
                            "value": 0.95,
                            "origin": "default",
                            "scope": null,
                            "setBy": null,
                            "setAt": null
                          },
                          "inventory.review_period_days": {
                            "value": 14,
                            "origin": "default",
                            "scope": null,
                            "setBy": null,
                            "setAt": null
                          }
                        }
                      }
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "proposals"
        }
      }
    },
    "/v1/inventory/rebalance_recommendations": {
      "get": {
        "operationId": "listRebalanceRecommendations",
        "summary": "Ranked transfer proposals. Read-only; `planning` in the answer says whether it is the latest stored result or one made for this request's settings. The same proposals are listed as proposed recommendations",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `recommendations`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "service_level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0.5,
              "maximum": 0.999
            },
            "description": "Applies to every item of this request; left out, each item and location plans on its own value in force (default 0.95)"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "min_priority",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RebalanceRecommendation"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "recommendations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RebalanceRecommendation"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "service_level": {
                      "type": "number",
                      "description": "The request's service level, else the account-wide value in force"
                    },
                    "service_level_source": {
                      "type": "string",
                      "enum": [
                        "request",
                        "default",
                        "observed",
                        "stated"
                      ]
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "recommendation_count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging; absent when the answer is read from stored results"
                    },
                    "rules": {
                      "type": "object",
                      "properties": {
                        "items_with_pack": {
                          "type": "integer",
                          "description": "Items moved in whole packs"
                        },
                        "pack_from_parameter": {
                          "type": "integer"
                        },
                        "pack_from_erp": {
                          "type": "integer"
                        },
                        "max_stock_set": {
                          "type": "boolean",
                          "description": "Whether a maximum stock is set anywhere"
                        },
                        "lanes_with_transit": {
                          "type": "integer",
                          "description": "Location-to-location lanes with a transit time"
                        },
                        "range_basis": {
                          "type": "string",
                          "enum": [
                            "range",
                            "carried"
                          ],
                          "description": "range: receivers were checked against the item-to-location range; carried: no range applies"
                        }
                      },
                      "required": [
                        "items_with_pack",
                        "pack_from_parameter",
                        "pack_from_erp",
                        "max_stock_set",
                        "lanes_with_transit",
                        "range_basis"
                      ]
                    },
                    "compliance": {
                      "$ref": "#/components/schemas/PlanningComplianceExclusions"
                    },
                    "planning": {
                      "$ref": "#/components/schemas/InventoryResultSource"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "recommendations",
                    "window_days",
                    "service_level",
                    "service_level_source",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "recommendation_count",
                    "rules",
                    "planning",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "2b57dc9f-d42c-4f71-9224-632c3c0a60d2",
                  "window_days": 90,
                  "service_level": 0.95,
                  "service_level_source": "default",
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "recommendation_count": 100,
                  "total": 2424,
                  "has_more": true,
                  "rules": {
                    "items_with_pack": 0,
                    "pack_from_parameter": 0,
                    "pack_from_erp": 0,
                    "max_stock_set": false,
                    "lanes_with_transit": 0,
                    "range_basis": "carried"
                  },
                  "recommendations": [
                    {
                      "item": "MAT-00000211",
                      "from_location": "1005",
                      "to_location": "1018",
                      "quantity": 14,
                      "priority": 89.13,
                      "rationale": {
                        "receiver_on_hand": 0,
                        "receiver_reorder_point": 14.16,
                        "receiver_days_of_cover": 0,
                        "receiver_deficit": 14.16,
                        "donor_on_hand": 37,
                        "donor_days_of_cover": null,
                        "donor_excess": 37,
                        "donor_dead_stock": true,
                        "transfer_value": 6710.2,
                        "lead_time_days": 58,
                        "disruption_affected": true,
                        "lead_time_source": "supplier_master",
                        "service_level": 0.95,
                        "parameters": {
                          "inventory.service_level": {
                            "value": 0.95,
                            "origin": "default",
                            "scope": null,
                            "setBy": null,
                            "setAt": null
                          },
                          "inventory.lead_time_fallback_days": {
                            "value": 14,
                            "origin": "default",
                            "scope": null,
                            "setBy": null,
                            "setAt": null
                          }
                        }
                      },
                      "expected_impact": {
                        "receiver_days_of_cover_after": 140,
                        "donor_days_of_cover_after": null,
                        "stockout_risk_before": "imminent"
                      }
                    }
                  ],
                  "compliance": {
                    "mode": "flag",
                    "excluded": 0,
                    "excluded_needs": []
                  },
                  "planning": {
                    "source": "on_request",
                    "reason": "no_stored_result"
                  },
                  "duration_ms": 218,
                  "notes": [
                    "Recommendations are advisory only; no changes are made to any ERP system."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000211",
                      "from_location": "1005",
                      "to_location": "1018",
                      "quantity": 14,
                      "priority": 89.13,
                      "rationale": {
                        "receiver_on_hand": 0,
                        "receiver_reorder_point": 14.16,
                        "receiver_days_of_cover": 0,
                        "receiver_deficit": 14.16,
                        "donor_on_hand": 37,
                        "donor_days_of_cover": null,
                        "donor_excess": 37,
                        "donor_dead_stock": true,
                        "transfer_value": 6710.2,
                        "lead_time_days": 58,
                        "disruption_affected": true,
                        "lead_time_source": "supplier_master",
                        "service_level": 0.95,
                        "parameters": {
                          "inventory.service_level": {
                            "value": 0.95,
                            "origin": "default",
                            "scope": null,
                            "setBy": null,
                            "setAt": null
                          },
                          "inventory.lead_time_fallback_days": {
                            "value": 14,
                            "origin": "default",
                            "scope": null,
                            "setBy": null,
                            "setAt": null
                          }
                        }
                      },
                      "expected_impact": {
                        "receiver_days_of_cover_after": 140,
                        "donor_days_of_cover_after": null,
                        "stockout_risk_before": "imminent"
                      }
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "recommendations"
        }
      }
    },
    "/v1/inventory/replenishment_params": {
      "get": {
        "operationId": "listReplenishmentParams",
        "summary": "Safety stock, reorder point and on-hand per item and location. Read-only; `planning` in the answer says whether it is the latest stored result or one made for this request's settings",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `replenishment_params`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "service_level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0.5,
              "maximum": 0.999
            },
            "description": "Applies to every item of this request; left out, each item and location plans on its own value in force (default 0.95)"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryReplenishmentParams"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "replenishment_params": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryReplenishmentParams"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "service_level": {
                      "type": "number",
                      "description": "The request's service level, else the account-wide value in force"
                    },
                    "service_level_source": {
                      "type": "string",
                      "enum": [
                        "request",
                        "default",
                        "observed",
                        "stated"
                      ]
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging; absent when the answer is read from stored results"
                    },
                    "planning": {
                      "$ref": "#/components/schemas/InventoryResultSource"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "replenishment_params",
                    "window_days",
                    "service_level",
                    "service_level_source",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "planning",
                    "notes",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "84b6615d-f061-424c-b564-d150c822bd17",
                  "window_days": 90,
                  "service_level": 0.95,
                  "service_level_source": "default",
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 100,
                  "total": 7378,
                  "has_more": true,
                  "replenishment_params": [
                    {
                      "item": "MAT-00000028",
                      "location": "1005",
                      "classification": "lumpy",
                      "mean_daily_demand": 12.1111,
                      "demand_std_dev": 46.2276,
                      "lead_time_days": 38,
                      "lead_time_source": "supplier_master",
                      "service_level": 0.95,
                      "safety_stock": 468.77,
                      "reorder_point": 928.99,
                      "on_hand": 0,
                      "below_reorder_point": true,
                      "review_period_days": 14,
                      "order_up_to_level": 1098.55,
                      "suggested_order_qty": 1099,
                      "above_max_after_rounding": false,
                      "min_stock": 0,
                      "max_stock": null,
                      "presentation_min": 0,
                      "order_constraints": {
                        "min_order_qty": 0,
                        "order_multiple": 1,
                        "case_pack": 1
                      },
                      "lead_time": {
                        "days": 38,
                        "source": "supplier_master",
                        "supplier_id": "b2e10740-bbed-48db-9eba-7d9fdacf41c3",
                        "master_days": 38
                      },
                      "parameters": {
                        "inventory.service_level": {
                          "value": 0.95,
                          "origin": "default",
                          "scope": null,
                          "setBy": null,
                          "setAt": null
                        },
                        "inventory.review_period_days": {
                          "value": 14,
                          "origin": "default",
                          "scope": null,
                          "setBy": null,
                          "setAt": null
                        }
                      }
                    }
                  ],
                  "planning": {
                    "source": "on_request",
                    "reason": "no_stored_result"
                  },
                  "duration_ms": 192,
                  "notes": [
                    "Each row plans on the parameters in force for the item at the location (parameters names each value and where it came from: the account's..."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000028",
                      "location": "1005",
                      "classification": "lumpy",
                      "mean_daily_demand": 12.1111,
                      "demand_std_dev": 46.2276,
                      "lead_time_days": 38,
                      "lead_time_source": "supplier_master",
                      "service_level": 0.95,
                      "safety_stock": 468.77,
                      "reorder_point": 928.99,
                      "on_hand": 0,
                      "below_reorder_point": true,
                      "review_period_days": 14,
                      "order_up_to_level": 1098.55,
                      "suggested_order_qty": 1099,
                      "above_max_after_rounding": false,
                      "min_stock": 0,
                      "max_stock": null,
                      "presentation_min": 0,
                      "order_constraints": {
                        "min_order_qty": 0,
                        "order_multiple": 1,
                        "case_pack": 1
                      },
                      "lead_time": {
                        "days": 38,
                        "source": "supplier_master",
                        "supplier_id": "b2e10740-bbed-48db-9eba-7d9fdacf41c3",
                        "master_days": 38
                      },
                      "parameters": {
                        "inventory.service_level": {
                          "value": 0.95,
                          "origin": "default",
                          "scope": null,
                          "setBy": null,
                          "setAt": null
                        },
                        "inventory.review_period_days": {
                          "value": 14,
                          "origin": "default",
                          "scope": null,
                          "setBy": null,
                          "setAt": null
                        }
                      }
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "replenishment_params"
        }
      }
    },
    "/v1/inventory/size_allocations": {
      "get": {
        "operationId": "listSizeAllocations",
        "summary": "Size-run split per store",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `allocations`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SizeAllocation"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "allocations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SizeAllocation"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging"
                    },
                    "note": {
                      "type": "string",
                      "description": "Present instead of the other fields when the organization has no item variants"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "allocations",
                    "count",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "9c883711-915f-4639-99f1-a1aa8ffaf663",
                  "window_days": 90,
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 100,
                  "total": 318,
                  "has_more": true,
                  "allocations": [
                    {
                      "item": "MAT-00000198",
                      "description": "Footwear - Style 00000198",
                      "available_units": 337,
                      "sizes": [
                        "OS"
                      ],
                      "store_allocations": [
                        {
                          "locationExternalId": "1004",
                          "totalUnits": 112,
                          "demandShare": 0.3333,
                          "sizes": [
                            {
                              "variantCode": "OS",
                              "units": 19,
                              "sizeShare": 0.1667
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "duration_ms": 117,
                  "notes": [
                    "Recommended size-run split per store: store share by demand, size split by each store's size mix (network mix fallback)."
                  ],
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000198",
                      "description": "Footwear - Style 00000198",
                      "available_units": 337,
                      "sizes": [
                        "OS"
                      ],
                      "store_allocations": [
                        {
                          "locationExternalId": "1004",
                          "totalUnits": 112,
                          "demandShare": 0.3333,
                          "sizes": [
                            {
                              "variantCode": "OS",
                              "units": 19,
                              "sizeShare": 0.1667
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "allocations"
        }
      }
    },
    "/v1/inventory/stockout_projections": {
      "get": {
        "operationId": "listStockoutProjections",
        "summary": "Days to stockout per item and location, with inbound; supplier_updates on a row says how ship notices, predicted arrivals and accepted supplier answers moved it. Read-only; `planning` in the answer says whether it is the latest stored result or one made for this request's settings",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor); the same rows stay under `projections`, deprecated.",
        "tags": [
          "inventory"
        ],
        "parameters": [
          {
            "name": "window_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 30,
              "maximum": 365,
              "default": 90
            },
            "description": "Demand history window"
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Narrow to one item (external id)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "supplier_updates",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "only"
              ]
            },
            "description": "only: just the projections the supplier network moved"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryStockoutProjection"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "projections": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InventoryStockoutProjection"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "window_days": {
                      "type": "integer",
                      "description": "Demand history window used"
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the organization's data was last received; null before the first sync"
                    },
                    "demand_source": {
                      "$ref": "#/components/schemas/DemandSource"
                    },
                    "stale": {
                      "type": "boolean",
                      "description": "True when the data is more than 24 hours old, or was never received"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Rows in this page"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Rows in the whole list, before paging; absent when the answer is read from stored results"
                    },
                    "supplier_updates_applied": {
                      "type": "integer",
                      "description": "Projections the supplier network moved"
                    },
                    "planning": {
                      "$ref": "#/components/schemas/InventoryResultSource"
                    },
                    "duration_ms": {
                      "type": "integer",
                      "description": "Milliseconds the request took"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "projections",
                    "window_days",
                    "data_as_of",
                    "demand_source",
                    "stale",
                    "count",
                    "supplier_updates_applied",
                    "planning",
                    "duration_ms",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "04744751-30b9-4b35-9998-1fd05aee364a",
                  "window_days": 90,
                  "data_as_of": null,
                  "demand_source": {
                    "source": "order_lines",
                    "history_complete": false,
                    "history_as_of": null,
                    "fallback_reason": "history_not_built"
                  },
                  "stale": true,
                  "count": 100,
                  "total": 4050,
                  "has_more": true,
                  "projections": [
                    {
                      "item": "MAT-00000433",
                      "description": "Handbags - Style 00000433",
                      "location": "1005",
                      "on_hand": 0,
                      "mean_daily_demand": 0.0556,
                      "stockout_in_days": 0,
                      "stockout_without_inbound_days": 0,
                      "rescued_by_inbound": false,
                      "uncovered_gap_days": 60,
                      "first_arrival_in_days": null
                    }
                  ],
                  "supplier_updates_applied": 2,
                  "planning": {
                    "source": "on_request",
                    "reason": "no_stored_result"
                  },
                  "duration_ms": 202,
                  "object": "list",
                  "data": [
                    {
                      "item": "MAT-00000433",
                      "description": "Handbags - Style 00000433",
                      "location": "1005",
                      "on_hand": 0,
                      "mean_daily_demand": 0.0556,
                      "stockout_in_days": 0,
                      "stockout_without_inbound_days": 0,
                      "rescued_by_inbound": false,
                      "uncovered_gap_days": 60,
                      "first_arrival_in_days": null
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "projections"
        }
      }
    },
    "/v1/landed_costs": {
      "post": {
        "operationId": "createLandedCost",
        "summary": "Total landed cost: CIF, duty (looked up as a tariff check, which also needs the tariff module, or your own rate), fees and import VAT. One of hs_code or item_description is required. Logs the calculation",
        "description": "Key scope: read (or execute). Module: landed_cost.",
        "tags": [
          "landed_costs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hs_code": {
                    "type": "string",
                    "maxLength": 17,
                    "description": "HS code, 6-10 digits (up to 12 for the UAE and Saudi Arabia); dots between groups are allowed. Required unless item_description is sent"
                  },
                  "item_description": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Used to classify when hs_code is absent. Required unless hs_code is sent"
                  },
                  "origin_country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "ISO 3166-1 alpha-2 country code"
                  },
                  "destination_country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "US (default), GB, CA, AE, SA, EG, or an EU member state"
                  },
                  "goods_value": {
                    "type": "number",
                    "minimum": 0
                  },
                  "freight_cost": {
                    "type": "number",
                    "minimum": 0
                  },
                  "insurance_cost": {
                    "type": "number",
                    "minimum": 0
                  },
                  "duty_rate_percent": {
                    "type": "number",
                    "minimum": 0,
                    "description": "Your own duty rate; replaces the lookup"
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000000,
                    "default": 1
                  },
                  "shipment_date": {
                    "type": "string",
                    "format": "date",
                    "description": "The day the goods begin their direct journey (default today). Canada: the rates in force and the Bank of Canada exchange rate of that day. UAE: the year a trade agreement's rate is read for"
                  },
                  "entry_channel": {
                    "type": "string",
                    "enum": [
                      "cargo",
                      "courier",
                      "post",
                      "ecommerce_parcel"
                    ],
                    "default": "cargo",
                    "description": "AE and SA: how the goods enter (sets the fee). ecommerce_parcel: the UAE's registered e-commerce channel, no duty at AED 1,000 or less"
                  },
                  "transport_mode": {
                    "type": "string",
                    "enum": [
                      "ocean",
                      "air",
                      "truck",
                      "rail",
                      "sea",
                      "land"
                    ],
                    "description": "US: ocean, air, truck or rail (harbor fee only for ocean). AE and SA: sea (default), air or land"
                  },
                  "bond": {
                    "type": "string",
                    "enum": [
                      "none",
                      "continuous",
                      "single_entry"
                    ],
                    "default": "none",
                    "description": "US: only single_entry adds a bond cost"
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "USD",
                      "CAD"
                    ],
                    "default": "USD",
                    "description": "Currency of the amounts; CAD for Canada only"
                  },
                  "metal_weight_percent": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100,
                    "description": "US: metal share of the article's weight; Section 232 on a derivative applies at 15% or more"
                  },
                  "import_zone": {
                    "type": "string",
                    "enum": [
                      "mainland",
                      "free_zone"
                    ],
                    "default": "mainland",
                    "description": "AE: free_zone when the goods enter a free zone (no duty or VAT until they reach the mainland)"
                  },
                  "personal_import": {
                    "type": "boolean",
                    "default": false,
                    "description": "SA: true for a person's own purchase from an online store (no duty under SAR 1,000; VAT always)"
                  },
                  "excise": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "category"
                    ],
                    "properties": {
                      "category": {
                        "type": "string",
                        "enum": [
                          "sweetened_drink",
                          "tobacco",
                          "energy_drink",
                          "e_smoking_device",
                          "e_liquid"
                        ]
                      },
                      "sugar_g_per_100ml": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100,
                        "description": "sweetened_drink: grams of total sugar per 100 ml"
                      },
                      "volume_litres": {
                        "type": "number",
                        "minimum": 0,
                        "description": "sweetened_drink: litres in the shipment, ready to drink"
                      },
                      "sweeteners_only": {
                        "type": "boolean",
                        "default": false,
                        "description": "sweetened_drink: sweeteners and no added sugar (no excise)"
                      },
                      "retail_price": {
                        "type": "number",
                        "minimum": 0,
                        "description": "Other categories: the shipment's retail price before tax, USD"
                      }
                    },
                    "description": "AE and SA: what excise is charged on. Without it, excise on excise goods is reported as not computed"
                  },
                  "measures": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "net_weight_kg": {
                        "type": "number",
                        "minimum": 0,
                        "description": "Net weight in kilograms"
                      },
                      "volume_litres": {
                        "type": "number",
                        "minimum": 0,
                        "description": "Volume in litres"
                      },
                      "cigarettes": {
                        "type": "number",
                        "minimum": 0,
                        "description": "The number of cigarettes"
                      }
                    },
                    "description": "EG: the quantities Egypt's tariff charges per unit on. With them, a duty or tax stated per net kilogram, per litre or per twenty cigarettes (and a minimum per unit) is computed; without them it is listed as not in the total"
                  }
                },
                "required": [
                  "origin_country",
                  "goods_value"
                ],
                "additionalProperties": false
              },
              "example": {
                "hs_code": "6109.10",
                "origin_country": "VN",
                "destination_country": "US",
                "goods_value": 12500,
                "freight_cost": 850,
                "insurance_cost": 60,
                "quantity": 1000
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LandedCost"
                },
                "example": {
                  "request_id": "02a9e9f2-532f-4fe0-b22e-2f4ed4813624",
                  "hs_code": "6109100010",
                  "hs_classification_source": null,
                  "origin_country": "CN",
                  "destination_country": "GB",
                  "currency": "USD",
                  "quantity": 1000,
                  "de_minimis_applied": false,
                  "de_minimis_note": null,
                  "cost_breakdown": {
                    "goods_value": 12000,
                    "freight_cost": 800,
                    "insurance_cost": 60,
                    "cif_value": 12860,
                    "customs_value": 12860,
                    "valuation_basis": "cif",
                    "valuation_note": "UK duty is charged on the goods value plus freight and insurance to the border.",
                    "duty_rate_percent": 12,
                    "duty_amount": 1543.2,
                    "adcvd_duty_amount": 0,
                    "fees": {},
                    "total_fees": 0,
                    "import_vat": {
                      "rate_percent": 20,
                      "amount": 2880.64,
                      "destination_country_name": "United Kingdom",
                      "destination_currency": "GBP",
                      "rate_source": "tariff_line"
                    }
                  },
                  "adcvd_orders": null,
                  "total_landed_cost": 17283.84,
                  "per_unit_landed_cost": 17.28,
                  "tariff_source": {
                    "effective_rate_display": "12.0%",
                    "effective_rate_mfn": null,
                    "effective_rate_preferential": null,
                    "base_rate": {
                      "rate": "12.00 %",
                      "type": "Third country duty",
                      "source": "UK Integrated Online Tariff",
                      "source_url": "https://www.trade-tariff.service.gov.uk/commodities/6109100010?country=CN&day=21&month=11&year=2026",
                      "rate_percent": 12
                    },
                    "additional_duties": [],
                    "trade_agreement": null,
                    "confidence_score": null,
                    "duty_rate_source": "tariff_lookup",
                    "duty_rate_status": "official",
                    "excluded_specific_duty": null,
                    "rate_warning": null
                  },
                  "tariff_authority": {
                    "url": "https://www.trade-tariff.service.gov.uk/commodities/6109100010?country=CN&day=21&month=11&year=2026",
                    "name": "UK Integrated Online Tariff",
                    "as_of": "2026-11-21",
                    "licence": "Contains public sector information licensed under the Open Government Licence v3.0 (HMRC UK Integrated Online Tariff).",
                    "authority": "uk_official_schedule"
                  },
                  "duration_ms": 105,
                  "disclaimer": "This landed cost estimate is provided for informational purposes only. Actual costs may vary based on broker fees, port charges, and othe..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "landed_cost",
        "x-writes": false
      }
    },
    "/v1/location_risks": {
      "post": {
        "operationId": "createLocationRisk",
        "summary": "Sanctions and trade-compliance risk for a country. Logs the screening",
        "description": "Key scope: read (or execute). Module: location_risk.",
        "tags": [
          "location_risks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country_code": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "ISO 3166-1 alpha-2 country code"
                  }
                },
                "required": [
                  "country_code"
                ],
                "additionalProperties": false
              },
              "example": {
                "country_code": "VN"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocationRisk"
                },
                "example": {
                  "request_id": "c0074016-3bff-4122-9915-fdb44471b6ed",
                  "country_code": "IR",
                  "country_name": "Iran",
                  "risk_level": "BLOCKED",
                  "sanctioned": true,
                  "embargo_type": "comprehensive",
                  "sanctions_programs": [
                    {
                      "name": "OFAC: Iran Sanctions",
                      "source_url": null
                    }
                  ],
                  "risk_factors": [
                    "EAR Country Group D:5 – U.S. arms embargoed country"
                  ],
                  "recommended_action": "BLOCK",
                  "regulatory_context": {
                    "fatf_status": "blacklist",
                    "cpi_tier": "low",
                    "ear_group": "D:2,D:3,D:4,D:5,E:1",
                    "source_urls": {
                      "fatf_status": "https://www.fatf-gafi.org/en/countries-detail/high-risk-and-other-monitored-jurisdictions.html",
                      "cpi_tier": "https://www.transparency.org/en/cpi/2025",
                      "ear_group": "https://www.bis.gov/ear/title-15/subtitle-b/chapter-vii/subchapter-c/part-740/supplement-no-1-740"
                    }
                  },
                  "duration_ms": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "location_risk",
        "x-writes": false
      }
    },
    "/v1/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "Model Context Protocol server (JSON-RPC: initialize, tools/list, tools/call, prompts, resources), listing the default toolset. An API key or an OAuth access token; each tool calls its route as the same caller, so the route's scope and module apply, and one tool call is one request. One JSON-RPC message per request: a batch (an array) is refused",
        "description": "Any active API key. API key only (no session). A body that is not one JSON-RPC request answers 400 with a JSON-RPC error envelope, not the Error object; the per-minute limit answers 429. A key's daily quota is not a 429 here: a tool call past it answers 200 with isError true and the error object as text, and reading a resource past it answers 200 with JSON-RPC error -32000. A 401 carries WWW-Authenticate.",
        "tags": [
          "mcp"
        ],
        "parameters": [
          {
            "name": "toolsets",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "The toolsets tools/list shows, comma-separated: core, inventory, risk, trade, compliance, actions, stores, finance, merch, data, all. Default core. Any tool can be called whichever set is listed"
          },
          {
            "name": "schemas",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "compact",
                "full"
              ]
            },
            "description": "The outputSchema form in tools/list: compact (top-level fields, default) or full (every field)"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": [
                      "2.0"
                    ]
                  },
                  "id": {
                    "type": [
                      "string",
                      "number",
                      "null"
                    ],
                    "description": "Echoed in the answer; left out for a notification"
                  },
                  "method": {
                    "type": "string",
                    "description": "The JSON-RPC method, e.g. initialize, tools/list or tools/call"
                  },
                  "params": {
                    "type": "object",
                    "description": "The method's parameters"
                  }
                },
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "additionalProperties": false
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "tools/list"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jsonrpc": {
                      "const": "2.0"
                    },
                    "id": {
                      "type": [
                        "string",
                        "number",
                        "null"
                      ],
                      "description": "The id of the request; null when it carried none or could not be read"
                    },
                    "result": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/McpInitializeResult"
                        },
                        {
                          "$ref": "#/components/schemas/McpToolsListResult"
                        },
                        {
                          "$ref": "#/components/schemas/McpToolsCallResult"
                        },
                        {
                          "type": "object",
                          "additionalProperties": true
                        }
                      ],
                      "description": "By method: initialize, tools/list, tools/call; prompts/list, prompts/get, resources/list, resources/templates/list and resources/read answer as the protocol defines; ping answers an empty object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "integer",
                          "description": "A JSON-RPC code: -32600 not a valid request, -32601 method not found, -32602 unknown tool, prompt or argument, -32002 resource not found, -32000 the key's daily quota is used up (reading a resource), -32603 the request failed on our side"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "description": "In place of result when the request could not be served"
                    }
                  },
                  "required": [
                    "jsonrpc",
                    "id"
                  ],
                  "description": "A JSON-RPC 2.0 response: exactly one of `result` and `error`"
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": 1,
                  "result": {
                    "protocolVersion": "2025-11-25",
                    "capabilities": {
                      "tools": {
                        "listChanged": false
                      },
                      "prompts": {
                        "listChanged": false
                      },
                      "resources": {
                        "subscribe": false,
                        "listChanged": false
                      }
                    },
                    "serverInfo": {
                      "name": "insightchain-supply-chain",
                      "title": "InsightChain",
                      "version": "2.0.0"
                    },
                    "instructions": "Start with get_guide. This connection lists the core toolset; a result cut at 32,000 bytes carries next_cursor."
                  }
                }
              }
            }
          },
          "202": {
            "description": "A notification (a method starting with notifications/): accepted, with no body",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            }
          },
          "400": {
            "description": "Invalid input: an unknown or invalid parameter (error.param names it) or a body the route does not accept",
            "headers": {
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/McpErrorEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "Internal error; quote request_id",
            "headers": {
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/McpErrorEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": null,
        "x-module": null,
        "x-writes": false
      }
    },
    "/v1/mcp/{toolset}": {
      "post": {
        "operationId": "mcpToolset",
        "summary": "The same server listing one toolset (core, inventory, risk, trade, compliance, actions, stores, finance, merch, data, all)",
        "description": "Any active API key. API key only (no session). A body that is not one JSON-RPC request answers 400 with a JSON-RPC error envelope, not the Error object; the per-minute limit answers 429. A key's daily quota is not a 429 here: a tool call past it answers 200 with isError true and the error object as text, and reading a resource past it answers 200 with JSON-RPC error -32000. A 401 carries WWW-Authenticate.",
        "tags": [
          "mcp"
        ],
        "parameters": [
          {
            "name": "toolset",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "core",
                "inventory",
                "risk",
                "trade",
                "compliance",
                "actions",
                "stores",
                "finance",
                "merch",
                "data",
                "all"
              ]
            }
          },
          {
            "name": "toolsets",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "The toolsets tools/list shows, comma-separated: core, inventory, risk, trade, compliance, actions, stores, finance, merch, data, all. Default core. Any tool can be called whichever set is listed"
          },
          {
            "name": "schemas",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "compact",
                "full"
              ]
            },
            "description": "The outputSchema form in tools/list: compact (top-level fields, default) or full (every field)"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": [
                      "2.0"
                    ]
                  },
                  "id": {
                    "type": [
                      "string",
                      "number",
                      "null"
                    ],
                    "description": "Echoed in the answer; left out for a notification"
                  },
                  "method": {
                    "type": "string",
                    "description": "The JSON-RPC method, e.g. initialize, tools/list or tools/call"
                  },
                  "params": {
                    "type": "object",
                    "description": "The method's parameters"
                  }
                },
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "additionalProperties": false
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "tools/list"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jsonrpc": {
                      "const": "2.0"
                    },
                    "id": {
                      "type": [
                        "string",
                        "number",
                        "null"
                      ],
                      "description": "The id of the request; null when it carried none or could not be read"
                    },
                    "result": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/McpInitializeResult"
                        },
                        {
                          "$ref": "#/components/schemas/McpToolsListResult"
                        },
                        {
                          "$ref": "#/components/schemas/McpToolsCallResult"
                        },
                        {
                          "type": "object",
                          "additionalProperties": true
                        }
                      ],
                      "description": "By method: initialize, tools/list, tools/call; prompts/list, prompts/get, resources/list, resources/templates/list and resources/read answer as the protocol defines; ping answers an empty object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "integer",
                          "description": "A JSON-RPC code: -32600 not a valid request, -32601 method not found, -32602 unknown tool, prompt or argument, -32002 resource not found, -32000 the key's daily quota is used up (reading a resource), -32603 the request failed on our side"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "description": "In place of result when the request could not be served"
                    }
                  },
                  "required": [
                    "jsonrpc",
                    "id"
                  ],
                  "description": "A JSON-RPC 2.0 response: exactly one of `result` and `error`"
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": 2,
                  "result": {
                    "content": [
                      {
                        "type": "text",
                        "text": "{\"object\":\"list\",\"data\":[{\"id\":\"019c6556-7c11-4dd7-a3b3-4477ab043253\",\"kind\":\"connector\",\"severity\":\"high\",\"status\":\"open\",\"title\":\"Sync of erp-main has failed three times\"}],\"has_more\":false,\"next_cursor\":null}"
                      }
                    ],
                    "structuredContent": {
                      "object": "list",
                      "data": [
                        {
                          "id": "019c6556-7c11-4dd7-a3b3-4477ab043253",
                          "kind": "connector",
                          "severity": "high",
                          "status": "open",
                          "title": "Sync of erp-main has failed three times"
                        }
                      ],
                      "has_more": false,
                      "next_cursor": null
                    },
                    "isError": false
                  }
                }
              }
            }
          },
          "202": {
            "description": "A notification (a method starting with notifications/): accepted, with no body",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            }
          },
          "400": {
            "description": "Invalid input: an unknown or invalid parameter (error.param names it) or a body the route does not accept",
            "headers": {
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/McpErrorEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "Internal error; quote request_id",
            "headers": {
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/McpErrorEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": null,
        "x-module": null,
        "x-writes": false
      }
    },
    "/v1/orders": {
      "get": {
        "operationId": "listOrders",
        "summary": "Orders in the approval loop with payload, policy decision, proposer and approver",
        "description": "Key scope: read (or execute). Module: execution. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `orders`, deprecated.",
        "tags": [
          "orders"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "proposed",
                "approved",
                "rejected",
                "canceled",
                "executing",
                "executed",
                "partially_applied",
                "failed"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            },
            "description": "Only this kind, exactly as a row's kind field gives it, e.g. purchase_order or stock_transfer"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExecutionOrder"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "orders": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExecutionOrder"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "orders",
                    "next_offset",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "1b3265e1-2e67-4f81-b081-de9e198542ce",
                  "orders": [
                    {
                      "id": "1f61fbed-1094-40a3-bb48-572297a6fcd5",
                      "recommendation_id": "a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                      "connection_id": null,
                      "kind": "purchase_order",
                      "status": "proposed",
                      "mode": null,
                      "payload": {
                        "summary": "Purchase 9 of MAT-00000029 from supplier VEND-000020",
                        "currency": "USD",
                        "quantity": 9,
                        "unit_cost": 62.95,
                        "item_external_id": "MAT-00000029",
                        "location_external_id": "1010",
                        "supplier_external_id": "VEND-000020"
                      },
                      "expected_impact": {
                        "cost": 566.55,
                        "revenue_protected": 10389.32,
                        "recommended_action": "purchase"
                      },
                      "recommendation_snapshot": {
                        "kind": "purchase",
                        "currency": "USD",
                        "priority": 100,
                        "quantity": 9,
                        "rationale": {
                          "cost": 566.55,
                          "item": "MAT-00000029",
                          "source": "disruption",
                          "location": "1010",
                          "supplier": "Taipei Hardware 0020",
                          "cost_note": "Priced at this supplier's last PO unit price."
                        },
                        "unit_cost": 62.95,
                        "data_as_of": "2026-11-21T09:18:15.826+00:00",
                        "captured_at": "2026-11-21T10:44:17.575Z",
                        "recommended_at": "2026-11-21T09:19:45.238929+00:00",
                        "expected_impact": {
                          "cost": 566.55,
                          "revenue_protected": 10389.32,
                          "recommended_action": "purchase"
                        },
                        "item_external_id": "MAT-00000029",
                        "recommendation_id": "a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                        "supplier_external_id": "VEND-000020",
                        "to_location_external_id": "1010",
                        "from_location_external_id": null
                      },
                      "idempotency_key": "rec:a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                      "maker": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                      "maker_api_key_id": "3f406b46-9929-4fa3-a217-c2e156c29a14",
                      "checker": null,
                      "checker_api_key_id": null,
                      "auto_approved": false,
                      "policy_id": null,
                      "policy_decision": {
                        "level": 1,
                        "checks": [
                          {
                            "ok": false,
                            "rule": "level",
                            "detail": "a person approves every order of this kind"
                          }
                        ],
                        "outcome": "manual",
                        "reasons": [
                          "a person approves every order of this kind"
                        ],
                        "version": null,
                        "policy_id": null,
                        "evaluated_at": "2026-11-21T10:44:17.576Z"
                      },
                      "amount": 566.55,
                      "currency": "USD",
                      "external_ref": null,
                      "verification": null,
                      "error": null,
                      "approved_at": null,
                      "executed_at": null,
                      "created_at": "2026-11-21T10:44:17.584267+00:00",
                      "updated_at": "2026-11-21T10:44:17.584267+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_offset": null,
                  "object": "list",
                  "data": [
                    {
                      "id": "1f61fbed-1094-40a3-bb48-572297a6fcd5",
                      "recommendation_id": "a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                      "connection_id": null,
                      "kind": "purchase_order",
                      "status": "proposed",
                      "mode": null,
                      "payload": {
                        "summary": "Purchase 9 of MAT-00000029 from supplier VEND-000020",
                        "currency": "USD",
                        "quantity": 9,
                        "unit_cost": 62.95,
                        "item_external_id": "MAT-00000029",
                        "location_external_id": "1010",
                        "supplier_external_id": "VEND-000020"
                      },
                      "expected_impact": {
                        "cost": 566.55,
                        "revenue_protected": 10389.32,
                        "recommended_action": "purchase"
                      },
                      "recommendation_snapshot": {
                        "kind": "purchase",
                        "currency": "USD",
                        "priority": 100,
                        "quantity": 9,
                        "rationale": {
                          "cost": 566.55,
                          "item": "MAT-00000029",
                          "source": "disruption",
                          "location": "1010",
                          "supplier": "Taipei Hardware 0020",
                          "cost_note": "Priced at this supplier's last PO unit price."
                        },
                        "unit_cost": 62.95,
                        "data_as_of": "2026-11-21T09:18:15.826+00:00",
                        "captured_at": "2026-11-21T10:44:17.575Z",
                        "recommended_at": "2026-11-21T09:19:45.238929+00:00",
                        "expected_impact": {
                          "cost": 566.55,
                          "revenue_protected": 10389.32,
                          "recommended_action": "purchase"
                        },
                        "item_external_id": "MAT-00000029",
                        "recommendation_id": "a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                        "supplier_external_id": "VEND-000020",
                        "to_location_external_id": "1010",
                        "from_location_external_id": null
                      },
                      "idempotency_key": "rec:a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                      "maker": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                      "maker_api_key_id": "3f406b46-9929-4fa3-a217-c2e156c29a14",
                      "checker": null,
                      "checker_api_key_id": null,
                      "auto_approved": false,
                      "policy_id": null,
                      "policy_decision": {
                        "level": 1,
                        "checks": [
                          {
                            "ok": false,
                            "rule": "level",
                            "detail": "a person approves every order of this kind"
                          }
                        ],
                        "outcome": "manual",
                        "reasons": [
                          "a person approves every order of this kind"
                        ],
                        "version": null,
                        "policy_id": null,
                        "evaluated_at": "2026-11-21T10:44:17.576Z"
                      },
                      "amount": 566.55,
                      "currency": "USD",
                      "external_ref": null,
                      "verification": null,
                      "error": null,
                      "approved_at": null,
                      "executed_at": null,
                      "created_at": "2026-11-21T10:44:17.584267+00:00",
                      "updated_at": "2026-11-21T10:44:17.584267+00:00"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "execution",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "orders"
        }
      }
    },
    "/v1/orders/actions": {
      "post": {
        "operationId": "createOrderAction",
        "summary": "Act in the approval loop: propose, edit_quantity and cancel (execute); approve, reject, execute and verify (approve, creator an org admin who is not the proposer); get_policies (read). A quantity a person set always waits for a person's approval, and whoever sets it becomes the order's proposer. With product compliance on, a cross-border order the current verdict blocks (or leaves unknown, in strict mode) is refused at propose, approve and execute with 409 and code compliance_blocked or compliance_unknown",
        "description": "Key scope per action: get_policies read, propose execute, edit_quantity execute, cancel execute, approve approve, reject approve, execute approve, verify approve. Module: execution. propose is repeat-safe through the body's idempotency_key; the Idempotency-Key header is not read.",
        "tags": [
          "orders"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "get_policies",
                      "propose",
                      "edit_quantity",
                      "cancel",
                      "approve",
                      "reject",
                      "execute",
                      "verify"
                    ]
                  },
                  "recommendation_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The recommendation id. Required when action is propose"
                  },
                  "order_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The order id. Required when action is edit_quantity, approve, reject, cancel, execute or verify"
                  },
                  "action_request_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Deprecated: use order_id",
                    "deprecated": true
                  },
                  "connection_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "propose: the ERP connection to write to (GET /v1/connections)"
                  },
                  "idempotency_key": {
                    "type": "string",
                    "description": "propose: your own key for this proposal. Proposing again with the same key returns the order made the first time; left out, a recommendation is proposed once"
                  },
                  "quantity": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10000000,
                    "description": "The planner's quantity, above 0, at most three decimals, within the recommendation's own constraints. Required when action is edit_quantity; optional with propose, and then quantity_reason is required"
                  },
                  "quantity_reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500,
                    "description": "propose: why the quantity differs from the recommended one. Required when propose carries quantity"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500,
                    "description": "Why the quantity changes. Required when action is edit_quantity"
                  }
                },
                "required": [
                  "action"
                ],
                "additionalProperties": false
              },
              "example": {
                "action": "propose",
                "recommendation_id": "5b8f6c1e-2d47-4a9b-8e21-7c6d5f4a3b2e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order": {
                      "$ref": "#/components/schemas/ExecutionOrderResult",
                      "description": "Every action but get_policies: the order, its status after the action, and what the action adds"
                    },
                    "decision": {
                      "$ref": "#/components/schemas/ExecutionDecision",
                      "description": "propose, for a new order: what the execution rule decided"
                    },
                    "idempotent": {
                      "const": true,
                      "description": "propose: the order already existed (same idempotency_key, by default one per recommendation) and is returned as it is"
                    },
                    "quantity_applied": {
                      "const": false,
                      "description": "propose, with idempotent: the quantity sent was not applied to the existing order; change it with edit_quantity"
                    },
                    "policies": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExecutionPolicy"
                      },
                      "description": "get_policies: the rule in force per order kind; a kind without one waits for a person"
                    },
                    "kinds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "stock_transfer",
                          "purchase_order",
                          "expedite",
                          "markdown"
                        ]
                      },
                      "description": "get_policies: every order kind"
                    },
                    "writable_kinds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "stock_transfer",
                          "purchase_order",
                          "expedite",
                          "markdown"
                        ]
                      },
                      "description": "get_policies: kinds at least one connection can write to the ERP"
                    },
                    "connections": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "system_type": {
                            "type": "string"
                          },
                          "writable_kinds": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "stock_transfer",
                                "purchase_order",
                                "expedite",
                                "markdown"
                              ]
                            }
                          },
                          "access_mode": {
                            "type": "string",
                            "enum": [
                              "read_only",
                              "read_write"
                            ],
                            "description": "read_only: executions are dry runs; read_write: an organization admin allowed writes"
                          },
                          "writeback_enabled": {
                            "type": "boolean",
                            "description": "access_mode is read_write"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "system_type",
                          "writable_kinds",
                          "access_mode",
                          "writeback_enabled"
                        ]
                      },
                      "description": "get_policies: connections that can write orders"
                    },
                    "writeback_feature": {
                      "type": "boolean",
                      "description": "get_policies: whether ERP write-back is turned on for the organization"
                    },
                    "compliance_gate": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "mode": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "flag",
                            "strict",
                            null
                          ],
                          "description": "null while the gate is off"
                        }
                      },
                      "required": [
                        "enabled",
                        "mode"
                      ],
                      "description": "get_policies: the product compliance check on orders"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "request_id"
                  ],
                  "description": "Depends on `action`. get_policies: policies, kinds, writable_kinds, connections, writeback_feature and compliance_gate. propose: order and decision, or order and idempotent for an order that already existed. edit_quantity, approve, reject, cancel, execute, verify: order"
                },
                "example": {
                  "request_id": "3178a9cd-d63d-4b79-9419-49b0d2ba023e",
                  "order": {
                    "id": "9920f152-30a1-4b35-a975-a80edd2da8c1",
                    "status": "proposed"
                  },
                  "decision": {
                    "outcome": "manual",
                    "level": 1,
                    "policy_id": null,
                    "version": null,
                    "checks": [],
                    "reasons": [
                      "No rule is set for purchase orders: a person approves"
                    ],
                    "evaluated_at": "2026-11-21T10:44:17.575Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-scope-by-action": {
          "get_policies": "read",
          "propose": "execute",
          "edit_quantity": "execute",
          "cancel": "execute",
          "approve": "approve",
          "reject": "approve",
          "execute": "approve",
          "verify": "approve"
        },
        "x-module": "execution",
        "x-writes": true
      }
    },
    "/v1/orders/{id}": {
      "get": {
        "operationId": "getOrder",
        "summary": "One order",
        "description": "Key scope: read (or execute). Module: execution.",
        "tags": [
          "orders"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order": {
                      "$ref": "#/components/schemas/ExecutionOrder"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "order",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "ccb749f7-0486-450a-a2fe-ccb34ec9ff27",
                  "order": {
                    "id": "1f61fbed-1094-40a3-bb48-572297a6fcd5",
                    "recommendation_id": "a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                    "connection_id": null,
                    "kind": "purchase_order",
                    "status": "proposed",
                    "mode": null,
                    "payload": {
                      "summary": "Purchase 9 of MAT-00000029 from supplier VEND-000020",
                      "currency": "USD",
                      "quantity": 9,
                      "unit_cost": 62.95,
                      "item_external_id": "MAT-00000029",
                      "location_external_id": "1010",
                      "supplier_external_id": "VEND-000020"
                    },
                    "expected_impact": {
                      "cost": 566.55,
                      "revenue_protected": 10389.32,
                      "recommended_action": "purchase"
                    },
                    "recommendation_snapshot": {
                      "kind": "purchase",
                      "currency": "USD",
                      "priority": 100,
                      "quantity": 9,
                      "rationale": {
                        "cost": 566.55,
                        "item": "MAT-00000029",
                        "source": "disruption",
                        "location": "1010",
                        "supplier": "Taipei Hardware 0020",
                        "cost_note": "Priced at this supplier's last PO unit price."
                      },
                      "unit_cost": 62.95,
                      "data_as_of": "2026-11-21T09:18:15.826+00:00",
                      "captured_at": "2026-11-21T10:44:17.575Z",
                      "recommended_at": "2026-11-21T09:19:45.238929+00:00",
                      "expected_impact": {
                        "cost": 566.55,
                        "revenue_protected": 10389.32,
                        "recommended_action": "purchase"
                      },
                      "item_external_id": "MAT-00000029",
                      "recommendation_id": "a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                      "supplier_external_id": "VEND-000020",
                      "to_location_external_id": "1010",
                      "from_location_external_id": null
                    },
                    "idempotency_key": "rec:a2c7217b-a102-4f9a-83f2-e3e347c5ebb2",
                    "maker": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                    "maker_api_key_id": "3f406b46-9929-4fa3-a217-c2e156c29a14",
                    "checker": null,
                    "checker_api_key_id": null,
                    "auto_approved": false,
                    "policy_id": null,
                    "policy_decision": {
                      "level": 1,
                      "checks": [
                        {
                          "ok": false,
                          "rule": "level",
                          "detail": "a person approves every order of this kind"
                        }
                      ],
                      "outcome": "manual",
                      "reasons": [
                        "a person approves every order of this kind"
                      ],
                      "version": null,
                      "policy_id": null,
                      "evaluated_at": "2026-11-21T10:44:17.576Z"
                    },
                    "amount": 566.55,
                    "currency": "USD",
                    "external_ref": null,
                    "verification": null,
                    "error": null,
                    "approved_at": null,
                    "executed_at": null,
                    "created_at": "2026-11-21T10:44:17.584267+00:00",
                    "updated_at": "2026-11-21T10:44:17.584267+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "execution",
        "x-writes": false
      }
    },
    "/v1/parcel_assessments": {
      "post": {
        "operationId": "createParcelAssessment",
        "summary": "What each of up to 200 cross-border parcels into the UAE or Saudi Arabia will be charged and what it needs to enter: duty or the low-value exemption that applied, excise status, the declaration fee, VAT and the total in AED or SAR, the import conditions on file for the tariff code, and, when a seller or buyer is named, whether the name resembles an entry on a denied-party list. A parcel that cannot be assessed gets its own error entry and the others are still answered. A Saudi duty rate is marked unverified. Also needs the tariff module; names are screened only with the screening module. Nothing about a parcel or the people named is stored",
        "description": "Key scope: read (or execute). Module: landed_cost. At most 200 parcels in one request. A party's `matches` are cut at 5.",
        "tags": [
          "parcel_assessments"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "parcels": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100,
                          "description": "Your own reference for the parcel, unique in the request; the answer carries it back"
                        },
                        "destination_country": {
                          "type": "string",
                          "enum": [
                            "AE",
                            "SA",
                            "EG"
                          ],
                          "description": "AE (the UAE), SA (Saudi Arabia) or EG (Egypt)"
                        },
                        "hs_code": {
                          "type": "string",
                          "maxLength": 17,
                          "description": "Tariff code, 6 to 12 digits (Egypt: 6 to 10); dots between groups are allowed. The full code gives the exact line and settles the import conditions"
                        },
                        "measures": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "net_weight_kg": {
                              "type": "number",
                              "minimum": 0,
                              "description": "Net weight in kilograms"
                            },
                            "volume_litres": {
                              "type": "number",
                              "minimum": 0,
                              "description": "Volume in litres"
                            },
                            "cigarettes": {
                              "type": "number",
                              "minimum": 0,
                              "description": "The number of cigarettes"
                            }
                          },
                          "description": "EG: the quantities Egypt's tariff charges per unit on. With them, a duty or tax stated per net kilogram, per litre or per twenty cigarettes (and a minimum per unit) is computed; without them it is listed as not in the total"
                        },
                        "origin_country": {
                          "type": "string",
                          "pattern": "^[A-Za-z]{2}$",
                          "description": "Where the goods were made (ISO 3166-1 alpha-2)"
                        },
                        "goods_value": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000,
                          "description": "Value of the goods, US dollars; above 0"
                        },
                        "freight_cost": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000,
                          "description": "Shipping to the destination, US dollars (default 0). It is part of the customs value"
                        },
                        "insurance_cost": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000,
                          "description": "Insurance, US dollars (default 0). It is part of the customs value"
                        },
                        "currency": {
                          "type": "string",
                          "enum": [
                            "USD"
                          ],
                          "default": "USD",
                          "description": "The currency of the amounts sent. Only USD"
                        },
                        "entry_channel": {
                          "type": "string",
                          "enum": [
                            "courier",
                            "post",
                            "ecommerce_parcel"
                          ],
                          "default": "courier",
                          "description": "How the parcel enters. ecommerce_parcel is the UAE's registered cross-border e-commerce channel: no duty at a customs value of AED 1,000 or less"
                        },
                        "personal_import": {
                          "type": "boolean",
                          "default": false,
                          "description": "SA: true for a person's own purchase from an online store (no duty at a customs value under SAR 1,000, unless the goods need a permit)"
                        },
                        "excise": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "category"
                          ],
                          "properties": {
                            "category": {
                              "type": "string",
                              "enum": [
                                "sweetened_drink",
                                "tobacco",
                                "energy_drink",
                                "e_smoking_device",
                                "e_liquid"
                              ]
                            },
                            "sugar_g_per_100ml": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 100,
                              "description": "sweetened_drink: grams of total sugar per 100 ml"
                            },
                            "volume_litres": {
                              "type": "number",
                              "minimum": 0,
                              "description": "sweetened_drink: litres in the parcel, ready to drink"
                            },
                            "sweeteners_only": {
                              "type": "boolean",
                              "default": false,
                              "description": "sweetened_drink: sweeteners and no added sugar (no excise)"
                            },
                            "retail_price": {
                              "type": "number",
                              "minimum": 0,
                              "description": "The other categories: the retail price before tax, US dollars (excise is 100% of it)"
                            }
                          },
                          "description": "What excise tax is charged on, for excise goods. Without it, excise on a code of excise goods is reported as not computed. Excise goods never get the low-value exemption"
                        },
                        "seller": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 200,
                              "description": "The seller's name"
                            },
                            "country": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$",
                              "description": "The seller's country (ISO 3166-1 alpha-2): a list entry of the same country scores higher"
                            }
                          },
                          "required": [
                            "name"
                          ],
                          "additionalProperties": false,
                          "description": "The seller, to compare the name with the denied-party lists. Not stored"
                        },
                        "buyer": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 200,
                              "description": "The buyer's name"
                            },
                            "country": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$",
                              "description": "The buyer's country (ISO 3166-1 alpha-2): a list entry of the same country scores higher"
                            }
                          },
                          "required": [
                            "name"
                          ],
                          "additionalProperties": false,
                          "description": "The buyer, to compare the name with the denied-party lists. Not stored"
                        }
                      },
                      "required": [
                        "id",
                        "destination_country",
                        "hs_code",
                        "origin_country",
                        "goods_value"
                      ],
                      "additionalProperties": true
                    },
                    "minItems": 1,
                    "maxItems": 200,
                    "description": "The parcels, at most 200. Each is checked on its own: one that fails becomes an error entry in the answer"
                  }
                },
                "required": [
                  "parcels"
                ],
                "additionalProperties": false
              },
              "example": {
                "parcels": [
                  {
                    "id": "ORD-20418-1",
                    "destination_country": "SA",
                    "hs_code": "9503.00.10",
                    "origin_country": "CN",
                    "goods_value": 180,
                    "freight_cost": 20,
                    "personal_import": true,
                    "seller": {
                      "name": "Harbor Outfitters Trading",
                      "country": "CN"
                    },
                    "buyer": {
                      "name": "Layla Rahimi",
                      "country": "SA"
                    }
                  },
                  {
                    "id": "ORD-20418-2",
                    "destination_country": "AE",
                    "hs_code": "6109.10",
                    "origin_country": "VN",
                    "goods_value": 60,
                    "freight_cost": 12,
                    "entry_channel": "ecommerce_parcel"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": "string",
                      "format": "date",
                      "description": "The day the rates and rules were read for (today, UTC)"
                    },
                    "received": {
                      "type": "integer"
                    },
                    "assessed": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/ParcelAssessment"
                          },
                          {
                            "$ref": "#/components/schemas/ParcelError"
                          }
                        ]
                      },
                      "description": "One entry per parcel, in the order sent: an assessment, or the parcel's own error"
                    },
                    "screening_note": {
                      "type": "string"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "as_of",
                    "received",
                    "assessed",
                    "failed",
                    "results",
                    "screening_note",
                    "disclaimer",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "3f0c7a52-9b1e-4d6a-8c2f-5e7d9a1b4c60",
                  "as_of": "2026-11-27",
                  "received": 3,
                  "assessed": 2,
                  "failed": 1,
                  "results": [
                    {
                      "index": 0,
                      "id": "ORD-20418-1",
                      "status": "assessed",
                      "destination_country": "SA",
                      "origin_country": "CN",
                      "hs_code": "95030010",
                      "resolved_code": "95030010",
                      "description": "Tricycles, scooters, pedal cars and similar wheeled toys; dolls' carriages",
                      "entry": {
                        "channel": "courier",
                        "personal_import": true
                      },
                      "currency": "SAR",
                      "exchange_rate": {
                        "base": "USD",
                        "quote": "SAR",
                        "rate": 3.75,
                        "note": "A fixed official rate: the currency is pegged to the US dollar.",
                        "source_url": "https://www.sama.gov.sa/en-US/FinExc/Pages/Currency.aspx"
                      },
                      "goods_value": 675,
                      "freight_cost": 75,
                      "insurance_cost": 0,
                      "customs_value": 750,
                      "duty": {
                        "rate_percent": 5,
                        "base_rate_percent": 5,
                        "rate_status": "unverified",
                        "rate_warning": "Unverified duty rate: Saudi Arabia does not publish its duty rates in a form that can be read here. The rate shown is the GCC common tari...",
                        "rate_note": null,
                        "preference": null,
                        "amount": 37.5,
                        "exemption": {
                          "rule": "sa_personal_online_purchase",
                          "status": "conditional",
                          "reason": "needs_permit_check",
                          "limit": {
                            "amount": 1000,
                            "currency": "SAR",
                            "comparison": "under"
                          },
                          "note": "The parcel is within the value limit, but the exemption does not cover goods that need a permit from an agency, and a rule on file applie...",
                          "source": {
                            "name": "ZATCA: purchases from online stores",
                            "url": "https://zatca.gov.sa/en/RulesRegulations/Taxes/Pages/customs-individual/e-stores-customers.aspx"
                          },
                          "conditional_on": [
                            "r-bf2bea3bcc8ed51b"
                          ],
                          "if_exempt": {
                            "duty_amount": 0,
                            "vat_amount": 114.75,
                            "total": 879.75
                          }
                        },
                        "code_match": "exact",
                        "source": {
                          "authority": "gcc_common_tariff",
                          "as_of": "2026-11-27"
                        }
                      },
                      "excise": {
                        "status": "not_applicable",
                        "amount": 0,
                        "basis": null,
                        "source": null,
                        "source_url": null
                      },
                      "fee": {
                        "name": "Customs declaration fee",
                        "amount": 15,
                        "note": "0.15% of the customs value per declaration, at least SAR 15 and at most SAR 500 (The Fees Rules on Customs Services (ZATCA Board decision..."
                      },
                      "vat": {
                        "rate_percent": 15,
                        "taxable_base": 802.5,
                        "amount": 120.38,
                        "note": "Charged whatever the value of the parcel."
                      },
                      "total": 922.88,
                      "compliance": {
                        "status": "conditional",
                        "conditions": [
                          {
                            "match": "applies",
                            "rule_ref": "r-bf2bea3bcc8ed51b",
                            "rule_type": "conformity",
                            "effect": "certificate_or_permit",
                            "requirement": "Toys: the goods are under the technical regulation for toys and need a product certificate of conformity and a shipment certificate.",
                            "satisfied_by": {
                              "documents": [
                                "certificate_of_conformity"
                              ]
                            },
                            "authority": "Saudi Standards, Metrology and Quality Organization",
                            "source_url": "https://www.saso.gov.sa/en/"
                          }
                        ],
                        "upcoming": [],
                        "note": "Saudi Arabia: the rules on file by tariff code are the conformity scheme's product list and the halal list. Other agencies' permits (food..."
                      },
                      "screening": {
                        "seller": {
                          "status": "possible_match",
                          "strength": "possible",
                          "best_score": 0.8412,
                          "matches": [
                            {
                              "name": "Harbour Outfitters Trading Co",
                              "list": "Entity List",
                              "programs": [
                                "Export controls"
                              ],
                              "country": "CN",
                              "entity_type": "Entity",
                              "score": 0.8412,
                              "name_score": 0.71,
                              "country_match": true
                            }
                          ],
                          "reason": null
                        },
                        "buyer": {
                          "status": "clear",
                          "strength": null,
                          "best_score": null,
                          "matches": [],
                          "reason": null
                        }
                      },
                      "notes": []
                    }
                  ],
                  "screening_note": "Names are compared with the denied-party lists for this answer only. Nothing about the people or companies named is stored.",
                  "disclaimer": "For information only. Amounts are in the destination's currency at its official peg to the US dollar. Broker and carrier charges, each po..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "landed_cost",
        "x-writes": false
      }
    },
    "/v1/passports": {
      "get": {
        "operationId": "listPassports",
        "summary": "Passports, most recently updated first",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `passports`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "published",
                "archived"
              ]
            }
          },
          {
            "name": "granularity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "model",
                "batch",
                "item"
              ]
            }
          },
          {
            "name": "compliance_state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "incomplete",
                "ready",
                "registered",
                "failing"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Search: part of the external id, brand or GTIN"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportSummary"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "passports": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportSummary"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Passports matching the filters"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer",
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "passports",
                    "total",
                    "limit",
                    "offset",
                    "request_id"
                  ]
                },
                "example": {
                  "passports": [
                    {
                      "id": "022736fc-32ba-4de3-9d49-e0271d238003",
                      "external_id": "TOTE-MAT-00000003",
                      "granularity": "model",
                      "title": {
                        "en": "Canvas tote",
                        "fr": "Cabas en toile"
                      },
                      "brand": "Northwind Atelier",
                      "category": "Handbags",
                      "gtin": "00012345678905",
                      "batch_lot": null,
                      "serial": null,
                      "status": "published",
                      "compliance_state": "incomplete",
                      "completeness_score": 81.11,
                      "public_enabled": false,
                      "updated_at": "2026-11-21T10:54:58.105618+00:00",
                      "profile": "textile",
                      "model_passport_id": null
                    }
                  ],
                  "total": 20,
                  "limit": 50,
                  "offset": 0,
                  "request_id": "497e78e9-b1a2-4945-9aca-b9100d23bda7",
                  "object": "list",
                  "data": [
                    {
                      "id": "022736fc-32ba-4de3-9d49-e0271d238003",
                      "external_id": "TOTE-MAT-00000003",
                      "granularity": "model",
                      "title": {
                        "en": "Canvas tote",
                        "fr": "Cabas en toile"
                      },
                      "brand": "Northwind Atelier",
                      "category": "Handbags",
                      "gtin": "00012345678905",
                      "batch_lot": null,
                      "serial": null,
                      "status": "published",
                      "compliance_state": "incomplete",
                      "completeness_score": 81.11,
                      "public_enabled": false,
                      "updated_at": "2026-11-21T10:54:58.105618+00:00",
                      "profile": "textile",
                      "model_passport_id": null
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "passports"
        }
      },
      "post": {
        "operationId": "createPassport",
        "summary": "Create a passport for an item you ingested. A batch passport links to the item's model passport, inherits from it, and is filled from the lot's ERP data",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$",
                    "description": "Your id for the passport"
                  },
                  "granularity": {
                    "type": "string",
                    "enum": [
                      "model",
                      "batch",
                      "item"
                    ]
                  },
                  "item_external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$",
                    "description": "The item's external id"
                  },
                  "lot_external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$",
                    "description": "The lot's external id. Required when granularity is batch"
                  },
                  "variant_external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$"
                  },
                  "epc": {
                    "type": "string",
                    "maxLength": 128,
                    "description": "The unit's tag. Required when granularity is item"
                  },
                  "gtin": {
                    "type": "string",
                    "pattern": "^([0-9]{8}|[0-9]{12,14})$",
                    "description": "GTIN-8, 12, 13 or 14: digits only, with a valid check digit. Returned as 14 digits"
                  },
                  "batch_lot": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20,
                    "pattern": "^[A-Za-z0-9!\"%&'()*+,./:;<=>?_-]+$",
                    "description": "Batch or lot number: letters, digits and ! \" % & ' ( ) * + , - . / : ; < = > ? _ (no spaces)"
                  },
                  "serial": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20,
                    "pattern": "^[A-Za-z0-9!\"%&'()*+,./:;<=>?_-]+$",
                    "description": "Serial number: letters, digits and ! \" % & ' ( ) * + , - . / : ; < = > ? _ (no spaces)"
                  },
                  "title": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "The product's name: a string (read as English), or one string per language, keyed by language tag (en, fr, pt-BR)"
                  },
                  "brand": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "category": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "profile": {
                    "type": "string",
                    "enum": [
                      "textile",
                      "leather_goods",
                      "food_coffee",
                      "food_general",
                      "appliance",
                      "general"
                    ],
                    "description": "Omitted: the model passport's profile for a batch, else suggested from the item's HS code and category (GET /profiles has the rule table)"
                  },
                  "eu_market": {
                    "type": "boolean",
                    "default": false,
                    "description": "Whether the product is placed on the EU market (then an EUDR-scope product needs a DDS reference)"
                  }
                },
                "required": [
                  "external_id",
                  "granularity",
                  "item_external_id"
                ],
                "additionalProperties": false
              },
              "example": {
                "external_id": "DPP-SKU-100",
                "granularity": "model",
                "item_external_id": "SKU-100",
                "gtin": "00400000000121",
                "title": {
                  "en": "Cotton T-shirt, white",
                  "fr": "T-shirt en coton, blanc"
                },
                "brand": "Harbor Outfitters",
                "category": "Tops"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "passport": {
                      "$ref": "#/components/schemas/Passport"
                    },
                    "profile_suggestion": {
                      "type": "object",
                      "properties": {
                        "profile": {
                          "type": "string",
                          "enum": [
                            "textile",
                            "leather_goods",
                            "food_coffee",
                            "food_general",
                            "appliance",
                            "general"
                          ],
                          "description": "The product profile the passport is scored against"
                        },
                        "ruleId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "profile",
                        "ruleId",
                        "reason"
                      ]
                    },
                    "erp_fill": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "What a batch passport was filled with from its lot, in plain sentences"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "passport",
                    "profile_suggestion",
                    "erp_fill",
                    "request_id"
                  ]
                },
                "example": {
                  "passport": {
                    "id": "5f042be4-0cce-4a7f-ab93-bbcb8c35ef81",
                    "org_id": "4fc7a944-6245-4491-b6af-694bd6bd14cf",
                    "external_id": "TOTE-MAT-00000023",
                    "granularity": "model",
                    "item_id": "221641ba-5901-43de-bacd-998771b3a578",
                    "variant_id": null,
                    "lot_id": null,
                    "tracked_unit_id": null,
                    "item_external_id": "MAT-00000023",
                    "lot_external_id": null,
                    "gtin": null,
                    "batch_lot": null,
                    "serial": null,
                    "title": {
                      "en": "Canvas tote",
                      "fr": "Cabas en toile"
                    },
                    "brand": "Northwind",
                    "category": "Handbags",
                    "status": "draft",
                    "published_version_id": null,
                    "draft_data": {},
                    "completeness_score": 0,
                    "compliance_state": "incomplete",
                    "ruleset_version": null,
                    "public_enabled": false,
                    "registry_ref": null,
                    "created_at": "2026-11-21T10:55:55.212128+00:00",
                    "updated_at": "2026-11-21T10:55:55.212128+00:00",
                    "profile": "textile",
                    "model_passport_id": null,
                    "eu_market": false
                  },
                  "profile_suggestion": {
                    "profile": "textile",
                    "ruleId": "kw-textile",
                    "reason": "category names apparel or textiles"
                  },
                  "erp_fill": [],
                  "request_id": "210d1c80-bb99-44ae-aa5d-510720f29781"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/bulk": {
      "post": {
        "operationId": "bulkCreatePassports",
        "summary": "Create model passports for items that have none, each with a profile (given, or suggested from the item); at most 200 items",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "item_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "The item's external id"
                        },
                        "profile": {
                          "type": "string",
                          "enum": [
                            "textile",
                            "leather_goods",
                            "food_coffee",
                            "food_general",
                            "appliance",
                            "general"
                          ],
                          "description": "The product profile, which picks the rule set: textile, leather_goods, food_coffee (voluntary: ESPR excludes food), food_general, appliance (guidance) or general"
                        }
                      },
                      "required": [
                        "item_external_id"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 200
                  },
                  "profile": {
                    "type": "string",
                    "enum": [
                      "textile",
                      "leather_goods",
                      "food_coffee",
                      "food_general",
                      "appliance",
                      "general"
                    ],
                    "description": "For items that name none; omitted: suggested per item"
                  }
                },
                "required": [
                  "items"
                ],
                "additionalProperties": false
              },
              "example": {
                "items": [
                  {
                    "item_external_id": "BLEND-1KG"
                  },
                  {
                    "item_external_id": "BLEND-250G",
                    "profile": "food_coffee"
                  }
                ],
                "profile": "food_coffee"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "item_external_id": {
                            "type": "string"
                          },
                          "profile": {
                            "type": "string",
                            "enum": [
                              "textile",
                              "leather_goods",
                              "food_coffee",
                              "food_general",
                              "appliance",
                              "general"
                            ],
                            "description": "The product profile the passport is scored against"
                          }
                        },
                        "required": [
                          "id",
                          "external_id",
                          "item_external_id",
                          "profile"
                        ]
                      }
                    },
                    "skipped": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "item_external_id": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "item_external_id",
                          "reason"
                        ]
                      }
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "created",
                    "skipped",
                    "request_id"
                  ]
                },
                "example": {
                  "created": [
                    {
                      "id": "6e8a0c23-7d9f-4b1a-8c3e-4f5a6b7c8d9e",
                      "external_id": "DPP-BLEND-1KG",
                      "item_external_id": "BLEND-1KG",
                      "profile": "food_coffee"
                    }
                  ],
                  "skipped": [
                    {
                      "item_external_id": "TOTE-MAT-00000003",
                      "reason": "already has a model passport"
                    }
                  ],
                  "request_id": "7f9b1d34-8e0a-4c2b-9d4f-5a6b7c8d9e0f"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/catalog/items": {
      "get": {
        "operationId": "searchPassportCatalogItems",
        "summary": "Items to create passports for: id, description, category, HS code, GTIN, the model passport if any, and the suggested profile (top 25)",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Search: part of the item's external id or description"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "external_id": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "hs_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "gtin": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "country_of_origin": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "ISO 3166-1 alpha-2 country code"
                          },
                          "model_passport_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "suggested_profile": {
                            "type": "object",
                            "properties": {
                              "profile": {
                                "type": "string",
                                "enum": [
                                  "textile",
                                  "leather_goods",
                                  "food_coffee",
                                  "food_general",
                                  "appliance",
                                  "general"
                                ],
                                "description": "The product profile the passport is scored against"
                              },
                              "ruleId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "reason": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "profile",
                              "ruleId",
                              "reason"
                            ]
                          }
                        },
                        "required": [
                          "external_id",
                          "description",
                          "category",
                          "hs_code",
                          "gtin",
                          "country_of_origin",
                          "model_passport_id",
                          "suggested_profile"
                        ]
                      }
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "items",
                    "request_id"
                  ]
                },
                "example": {
                  "items": [
                    {
                      "external_id": "BLEND-1KG",
                      "description": "Espresso blend, 1 kg",
                      "category": "Coffee",
                      "hs_code": "0901.21",
                      "gtin": "00400000000121",
                      "country_of_origin": null,
                      "model_passport_id": null,
                      "suggested_profile": {
                        "profile": "food_coffee",
                        "ruleId": "hs-0901",
                        "reason": "HS 0901: coffee"
                      }
                    }
                  ],
                  "request_id": "9b1d3f56-0a2c-4e4d-9f6b-7c8d9e0f1a2b"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      }
    },
    "/v1/passports/catalog/items/{item_id}/lots": {
      "get": {
        "operationId": "listPassportCatalogLots",
        "summary": "An item's lots, newest first, each with its batch passport if any",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "item_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The item's external id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "lots": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "external_id": {
                            "type": "string"
                          },
                          "lot_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "manufactured_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date"
                          },
                          "expiry_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date"
                          },
                          "country_of_origin": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "ISO 3166-1 alpha-2 country code"
                          },
                          "batch_passport_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          }
                        },
                        "required": [
                          "external_id",
                          "lot_code",
                          "manufactured_date",
                          "expiry_date",
                          "country_of_origin",
                          "batch_passport_id"
                        ]
                      }
                    },
                    "model_passport_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "lots",
                    "model_passport_id",
                    "request_id"
                  ]
                },
                "example": {
                  "lots": [
                    {
                      "external_id": "R-2026-1120",
                      "lot_code": "R2611",
                      "manufactured_date": "2026-11-20",
                      "expiry_date": "2027-11-20",
                      "country_of_origin": null,
                      "batch_passport_id": null
                    }
                  ],
                  "model_passport_id": "022736fc-32ba-4de3-9d49-e0271d238003",
                  "request_id": "0c2e4a67-1b3d-4f5e-8a7c-8d9e0f1a2b3c"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      }
    },
    "/v1/passports/gaps": {
      "get": {
        "operationId": "listPassportGaps",
        "summary": "The completeness gaps across all passports",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `gaps`, deprecated.",
        "tags": [
          "passports"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportGapTotal"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "gaps": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportGapTotal"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "passports_assessed": {
                      "type": "integer",
                      "description": "Passports counted: every one that is not archived and has been scored since gaps were stored"
                    },
                    "passports_pending": {
                      "type": "integer",
                      "description": "Passports not scored yet; each request scores up to 25 of them"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "gaps",
                    "passports_assessed",
                    "passports_pending",
                    "request_id"
                  ]
                },
                "example": {
                  "gaps": [
                    {
                      "id": "identity.economic_operator",
                      "label": "EU economic operator (legal name, EORI, registered address)",
                      "section": "identity",
                      "severity": "blocking",
                      "count": 4,
                      "impact": 20
                    }
                  ],
                  "passports_assessed": 20,
                  "request_id": "d1d45e6a-8da5-4f87-a81d-ab065cfe163c",
                  "object": "list",
                  "data": [
                    {
                      "id": "identity.economic_operator",
                      "label": "EU economic operator (legal name, EORI, registered address)",
                      "section": "identity",
                      "severity": "blocking",
                      "count": 4,
                      "impact": 20
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "passports_pending": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "gaps"
        }
      }
    },
    "/v1/passports/lots/{lot_id}/dds_references": {
      "put": {
        "operationId": "replaceLotDdsReferences",
        "summary": "Replace a lot's Due Diligence Statement reference numbers (stored only, never submitted)",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "lot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The lot's external id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "references": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "reference_number": {
                          "type": "string",
                          "maxLength": 100,
                          "description": "The Due Diligence Statement reference number"
                        },
                        "verification_number": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "note": {
                          "type": "string",
                          "maxLength": 500
                        }
                      },
                      "required": [
                        "reference_number"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "description": "The whole list; an empty one removes every reference. Stored only: nothing is submitted to the EU information system"
                  }
                },
                "required": [
                  "references"
                ],
                "additionalProperties": false
              },
              "example": {
                "references": [
                  {
                    "reference_number": "25FRXXXXXXXXXX"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "references": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "reference_number": {
                            "type": "string"
                          },
                          "verification_number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "reference_number",
                          "verification_number",
                          "note"
                        ]
                      }
                    },
                    "submission": {
                      "type": "string",
                      "description": "A reminder that references are stored only and nothing is submitted to the EU information system"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "references",
                    "submission",
                    "request_id"
                  ]
                },
                "example": {
                  "references": [
                    {
                      "reference_number": "25FRXXXXXXXXXX",
                      "verification_number": null,
                      "note": null
                    }
                  ],
                  "submission": "Stored only. InsightChain does not submit Due Diligence Statements to the EU information system.",
                  "request_id": "5b7d9f12-6a8c-4e0d-9f2b-3c4d5e6f7a8b"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/lots/{lot_id}/eudr_plots": {
      "get": {
        "operationId": "listLotEudrPlots",
        "summary": "A lot's EUDR plots and DDS references, shared by every passport of the lot and of the lots made from it",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "lot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The lot's external id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "lot": {
                      "type": "object",
                      "properties": {
                        "external_id": {
                          "type": "string"
                        },
                        "lot_code": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "country_of_origin": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "ISO 3166-1 alpha-2 country code"
                        }
                      },
                      "required": [
                        "external_id",
                        "lot_code",
                        "country_of_origin"
                      ]
                    },
                    "plots": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "externalId": {
                            "type": "string"
                          },
                          "materialExternalId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The material the plot is for; null when it covers every in-scope material"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "geometry": {
                            "$ref": "#/components/schemas/PassportPlotGeometry"
                          },
                          "areaHa": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Hectares"
                          },
                          "producerCountry": {
                            "type": "string",
                            "description": "ISO 3166-1 alpha-2 country code"
                          },
                          "commodity": {
                            "type": "string",
                            "enum": [
                              "cattle",
                              "leather",
                              "wood",
                              "rubber",
                              "coffee",
                              "cocoa",
                              "palm_oil",
                              "soy"
                            ]
                          },
                          "producerName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "producerId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "deforestationFreeDeclaredBy": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Who declared the plot was not deforested after 2020-12-31: recorded, not checked"
                          },
                          "deforestationFreeDeclaredOn": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date"
                          },
                          "lotExternalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "submittedBySupplier": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "externalId",
                          "materialExternalId",
                          "description",
                          "geometry",
                          "areaHa",
                          "producerCountry",
                          "commodity",
                          "producerName",
                          "producerId",
                          "deforestationFreeDeclaredBy",
                          "deforestationFreeDeclaredOn",
                          "lotExternalId",
                          "submittedBySupplier"
                        ]
                      }
                    },
                    "dds_references": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lot_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "reference_number": {
                            "type": "string"
                          },
                          "verification_number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "recorded_by": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "lot_id",
                          "reference_number",
                          "verification_number",
                          "note",
                          "recorded_by",
                          "created_at"
                        ]
                      }
                    },
                    "submission": {
                      "type": "string",
                      "description": "A reminder that references are stored only and nothing is submitted to the EU information system"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "lot",
                    "plots",
                    "dds_references",
                    "submission",
                    "request_id"
                  ]
                },
                "example": {
                  "lot": {
                    "external_id": "GREEN-BR-2611",
                    "lot_code": "GREEN-BR-2611",
                    "country_of_origin": "BR"
                  },
                  "plots": [
                    {
                      "externalId": "FARM-001",
                      "description": "Farm 1",
                      "geometry": {
                        "type": "Point",
                        "coordinates": [
                          -45.12,
                          -21.24
                        ]
                      },
                      "areaHa": 2.5,
                      "producerCountry": "BR",
                      "commodity": "coffee",
                      "producerName": "Farm 1",
                      "producerId": null,
                      "deforestationFreeDeclaredBy": "Cooperative quality team",
                      "deforestationFreeDeclaredOn": "2026-10-01",
                      "lotExternalId": "GREEN-BR-2611",
                      "submittedBySupplier": true,
                      "materialExternalId": null
                    }
                  ],
                  "dds_references": [],
                  "submission": "References are stored here only. InsightChain does not submit Due Diligence Statements to the EU information system.",
                  "request_id": "2e4a6c89-3d5f-4b7a-8c9e-0f1a2b3c4d5e"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      },
      "put": {
        "operationId": "replaceLotEudrPlots",
        "summary": "Replace a lot's EUDR plots (up to 10,000). Plots a supplier submitted are kept",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "lot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The lot's external id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plots": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "external_id",
                        "producer_country",
                        "commodity",
                        "geometry"
                      ],
                      "properties": {
                        "external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "Your id for the plot, unique in the list"
                        },
                        "producer_country": {
                          "type": "string",
                          "pattern": "^[A-Za-z]{2}$",
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "commodity": {
                          "type": "string",
                          "enum": [
                            "cattle",
                            "leather",
                            "wood",
                            "rubber",
                            "coffee",
                            "cocoa",
                            "palm_oil",
                            "soy"
                          ]
                        },
                        "geometry": {
                          "type": "object",
                          "description": "GeoJSON Point, Polygon or MultiPolygon in WGS-84. A Point needs area_ha, at most 4"
                        },
                        "area_ha": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000,
                          "description": "Required when geometry is a Point"
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 300
                        },
                        "producer_name": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "producer_id": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "deforestation_free_declared_by": {
                          "type": "string",
                          "maxLength": 200,
                          "description": "Who declared the plot was not deforested after 2020-12-31 (recorded, not checked)"
                        },
                        "deforestation_free_declared_on": {
                          "type": "string",
                          "format": "date",
                          "description": "When they declared it"
                        }
                      }
                    },
                    "maxItems": 10000,
                    "description": "The whole list; an empty one removes every plot"
                  }
                },
                "required": [
                  "plots"
                ],
                "additionalProperties": false
              },
              "example": {
                "plots": [
                  {
                    "external_id": "FARM-001",
                    "producer_country": "BR",
                    "commodity": "coffee",
                    "geometry": {
                      "type": "Point",
                      "coordinates": [
                        -45.12,
                        -21.24
                      ]
                    },
                    "area_ha": 2.5,
                    "producer_name": "Farm one",
                    "deforestation_free_declared_by": "Cooperative quality team",
                    "deforestation_free_declared_on": "2026-10-01"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "written": {
                      "type": "integer"
                    },
                    "deleted": {
                      "type": "integer"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "written",
                    "deleted",
                    "request_id"
                  ]
                },
                "example": {
                  "written": 2,
                  "deleted": 0,
                  "request_id": "3f5b7d90-4e6a-4c8b-9d0f-1a2b3c4d5e6f"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/lots/{lot_id}/eudr_plots/import": {
      "post": {
        "operationId": "importLotEudrPlots",
        "summary": "Import EUDR plots from a GeoJSON FeatureCollection onto a lot (added or updated by external id; up to 10,000 features)",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "lot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The lot's external id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "feature_collection": {
                    "type": "object",
                    "description": "A GeoJSON FeatureCollection. Per feature: geometry (Point, Polygon, MultiPolygon) and properties external_id | plot_id | id, producer_country | country, commodity, area_ha | area, producer_name, producer_id, description | name, deforestation_free_declared_by, deforestation_free_declared_on"
                  },
                  "commodity": {
                    "type": "string",
                    "enum": [
                      "cattle",
                      "leather",
                      "wood",
                      "rubber",
                      "coffee",
                      "cocoa",
                      "palm_oil",
                      "soy"
                    ],
                    "description": "Used for features that name none"
                  },
                  "producer_country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "Used for features that name none"
                  }
                },
                "required": [
                  "feature_collection"
                ],
                "additionalProperties": false
              },
              "example": {
                "commodity": "coffee",
                "producer_country": "BR",
                "feature_collection": {
                  "type": "FeatureCollection",
                  "features": [
                    {
                      "type": "Feature",
                      "properties": {
                        "external_id": "FARM-001",
                        "producer_name": "Farm one",
                        "area_ha": 2.5,
                        "deforestation_free_declared_by": "Cooperative quality team",
                        "deforestation_free_declared_on": "2026-10-01"
                      },
                      "geometry": {
                        "type": "Point",
                        "coordinates": [
                          -45.12,
                          -21.24
                        ]
                      }
                    },
                    {
                      "type": "Feature",
                      "properties": {
                        "external_id": "FARM-002",
                        "producer_name": "Farm two"
                      },
                      "geometry": {
                        "type": "Polygon",
                        "coordinates": [
                          [
                            [
                              -45.2,
                              -21.3
                            ],
                            [
                              -45.19,
                              -21.3
                            ],
                            [
                              -45.19,
                              -21.29
                            ],
                            [
                              -45.2,
                              -21.3
                            ]
                          ]
                        ]
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "written": {
                      "type": "integer"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "externalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "issues": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "index",
                          "externalId",
                          "issues"
                        ]
                      }
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "written",
                    "errors",
                    "request_id"
                  ]
                },
                "example": {
                  "written": 1200,
                  "errors": [],
                  "request_id": "4a6c8e01-5f7b-4d9c-8e1a-2b3c4d5e6f7a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/profiles": {
      "get": {
        "operationId": "listPassportProfiles",
        "summary": "The product profiles (rule set, regulatory status, sections) and the rule table that suggests one for an item",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "profiles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "enum": [
                              "textile",
                              "leather_goods",
                              "food_coffee",
                              "food_general",
                              "appliance",
                              "general"
                            ],
                            "description": "The product profile the passport is scored against"
                          },
                          "label": {
                            "type": "string"
                          },
                          "ruleset_version": {
                            "type": "string"
                          },
                          "effective_date": {
                            "type": "string",
                            "format": "date"
                          },
                          "regulatory_status": {
                            "type": "string",
                            "enum": [
                              "espr_preparation",
                              "voluntary",
                              "guidance",
                              "minimal"
                            ],
                            "description": "espr_preparation: textile and leather (the ESPR textile act is not final); voluntary: food, which ESPR excludes; guidance: appliances; minimal: general"
                          },
                          "basis": {
                            "type": "string"
                          },
                          "operator_label": {
                            "type": "string"
                          },
                          "operator_asks_eori": {
                            "type": "boolean"
                          },
                          "sections": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "composition_label": {
                            "type": "string"
                          },
                          "composition_classes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "draft_keys": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "id",
                          "label",
                          "ruleset_version",
                          "effective_date",
                          "regulatory_status",
                          "basis",
                          "operator_label",
                          "operator_asks_eori",
                          "sections",
                          "composition_label",
                          "composition_classes",
                          "draft_keys"
                        ]
                      }
                    },
                    "suggestion_rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "profile": {
                            "type": "string",
                            "enum": [
                              "textile",
                              "leather_goods",
                              "food_coffee",
                              "food_general",
                              "appliance",
                              "general"
                            ],
                            "description": "The product profile the passport is scored against"
                          },
                          "hs_prefixes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "keywords": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "profile",
                          "hs_prefixes",
                          "keywords",
                          "reason"
                        ]
                      }
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "profiles",
                    "suggestion_rules",
                    "request_id"
                  ]
                },
                "example": {
                  "profiles": [
                    {
                      "id": "food_coffee",
                      "label": "Coffee",
                      "ruleset_version": "2026.11-food-coffee-v1",
                      "effective_date": "2026-11-27",
                      "regulatory_status": "voluntary",
                      "basis": "A voluntary product record. The EU passport regulation (ESPR, (EU) 2024/1781 Art. 1(2)) excludes food, so nothing here is an ESPR requirement and meeting every rule does not make the product compliant with anything.",
                      "operator_label": "Brand owner",
                      "operator_asks_eori": false,
                      "sections": [
                        "identity",
                        "operator",
                        "origins",
                        "food",
                        "production",
                        "packaging",
                        "certifications",
                        "care",
                        "impact",
                        "images"
                      ],
                      "composition_label": "Origins",
                      "composition_classes": [
                        "coffee_green",
                        "coffee_roasted",
                        "food_ingredient",
                        "cocoa",
                        "palm_oil",
                        "soy",
                        "other"
                      ],
                      "draft_keys": [
                        "economic_operator",
                        "manufacturing",
                        "care_instructions",
                        "impact",
                        "image_urls",
                        "certifications",
                        "food"
                      ]
                    }
                  ],
                  "suggestion_rules": [
                    {
                      "id": "hs-0901",
                      "profile": "food_coffee",
                      "hs_prefixes": [
                        "0901"
                      ],
                      "keywords": [],
                      "reason": "HS 0901: coffee"
                    }
                  ],
                  "request_id": "8a0c2e45-9f1b-4d3c-8e5a-6b7c8d9e0f1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      }
    },
    "/v1/passports/settings": {
      "get": {
        "operationId": "getPassportSettings",
        "summary": "The organization's passport settings: the public host Digital Links are minted on, and whether batch passports publish automatically",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "settings": {
                      "type": "object",
                      "properties": {
                        "public_host": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "auto_publish_batches": {
                          "type": "boolean"
                        },
                        "effective_public_host": {
                          "type": "string",
                          "description": "The host Digital Links are minted on now"
                        }
                      },
                      "required": [
                        "public_host",
                        "auto_publish_batches",
                        "effective_public_host"
                      ]
                    },
                    "can_set_public_host": {
                      "type": "boolean"
                    },
                    "gtins_owned": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "gtin": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "first_public",
                              "admin_override"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "gtin",
                          "source",
                          "created_at"
                        ]
                      }
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "settings",
                    "can_set_public_host",
                    "gtins_owned",
                    "request_id"
                  ]
                },
                "example": {
                  "settings": {
                    "public_host": null,
                    "auto_publish_batches": false,
                    "effective_public_host": "files.example.com"
                  },
                  "can_set_public_host": false,
                  "gtins_owned": [
                    {
                      "gtin": "00400000000121",
                      "source": "first_public",
                      "created_at": "2026-11-27T10:00:00+00:00"
                    }
                  ],
                  "request_id": "1d3f5b78-2c4e-4a6f-9b8d-9e0f1a2b3c4d"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      }
    },
    "/v1/passports/{id}": {
      "get": {
        "operationId": "getPassport",
        "summary": "One passport with every field, its completeness and its GS1 Digital Link",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "passport": {
                      "$ref": "#/components/schemas/Passport"
                    },
                    "view": {
                      "$ref": "#/components/schemas/PassportInternalView"
                    },
                    "completeness": {
                      "$ref": "#/components/schemas/PassportCompleteness"
                    },
                    "digital_link": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The GS1 Digital Link a scan resolves, on the organization's public host; null while the passport has no GTIN"
                    },
                    "model_passport": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "draft",
                            "published",
                            "archived"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "external_id",
                        "status"
                      ]
                    },
                    "erp_fill": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true,
                      "description": "A batch filled from its lot: lot_external_id, notes, green_lot_ids, filled_on"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "passport",
                    "view",
                    "completeness",
                    "digital_link",
                    "model_passport",
                    "erp_fill",
                    "request_id"
                  ]
                },
                "example": {
                  "passport": {
                    "id": "f76d228e-6ab6-4c1b-b5b1-30266d2ebc98",
                    "org_id": "4fc7a944-6245-4491-b6af-694bd6bd14cf",
                    "external_id": "NORTHWIND-HARBOR26-NH2601",
                    "granularity": "item",
                    "item_id": "612b1c85-2ce5-4953-8eab-5963ad7e1201",
                    "variant_id": null,
                    "lot_id": "e886ef53-5a6a-436b-a99c-44bdeaa13cd7",
                    "tracked_unit_id": "e545efc5-c959-485f-9d5b-1c608116e801",
                    "item_external_id": "NH2601",
                    "lot_external_id": "LOT-2026-0212",
                    "gtin": "00400000000121",
                    "batch_lot": "LOT-2026-0212",
                    "serial": "NW-26-0000001",
                    "title": {
                      "en": "Harbor Shoulder Bag 26",
                      "fr": "Sac porté épaule Harbor 26"
                    },
                    "brand": "Northwind",
                    "category": "Handbags",
                    "status": "published",
                    "published_version_id": "a866f7a4-0b87-49e4-b531-d1c9c2f01e75",
                    "draft_data": {
                      "impact": {
                        "method": "ISO_14067",
                        "boundary": "cradle_to_grave",
                        "water_m3": null,
                        "energy_kwh": null,
                        "carbon_kg_co2e": 24.6,
                        "methodology_note": "Cradle-to-grave footprint per ISO 14067, third-party reviewed. Excludes consumer-phase care."
                      },
                      "durability": [
                        {
                          "value": "Grade 5 (ISO 12947-2)",
                          "metric": "abrasion",
                          "standard_ref": "ISO 12947-2"
                        }
                      ],
                      "image_urls": [
                        "images/northwind-harbor-front.jpg"
                      ],
                      "circularity": {
                        "takeback_url": "https://www.example.com/second-life",
                        "material_routes": [
                          {
                            "route": "repurpose_second_life",
                            "material": "Full-grain cowhide leather"
                          }
                        ],
                        "recyclability_route": {
                          "en": "Leather body is repurposable through Northwind Second Life; hardware is recyclable as brass once separated."
                        },
                        "takeback_scheme_name": "Northwind Second Life",
                        "epr_registration_number": "IT-EPR-2026-441207"
                      },
                      "manufacturing": {
                        "assembly_country": "IT",
                        "facility_country": "IT",
                        "facility_external_id": "FAC-IT-0112"
                      },
                      "repairability": {
                        "score": 8.9,
                        "summary": {
                          "en": "Repairable for life through Northwind repair counters. Hardware, straps, and lining are all replaceable."
                        },
                        "spare_parts_url": "https://www.example.com/repair-counter",
                        "disassembly_steps": [
                          "Remove the shoulder strap at both swivel clips."
                        ],
                        "disassembly_tools": [
                          "PH0 screwdriver"
                        ]
                      },
                      "stage_origins": [
                        {
                          "stage": "fibre",
                          "country_code": "IT",
                          "facility_external_id": "FAC-IT-0044"
                        }
                      ],
                      "care_instructions": {
                        "en": "Wipe with a soft, dry cloth. Avoid prolonged exposure to direct sunlight and moisture. Store in the dust bag.",
                        "fr": "Essuyer avec un chiffon doux et sec. Éviter l'exposition prolongée au soleil et à l'humidité."
                      }
                    },
                    "completeness_score": 91.75,
                    "compliance_state": "incomplete",
                    "ruleset_version": "2026.08-textile-v1",
                    "public_enabled": true,
                    "registry_ref": null,
                    "created_at": "2026-11-21T09:18:15.073974+00:00",
                    "updated_at": "2026-11-21T10:54:58.078597+00:00",
                    "profile": "textile",
                    "model_passport_id": null,
                    "eu_market": false
                  },
                  "view": {
                    "audience": "internal",
                    "granularity": "item",
                    "product": {
                      "title": "Harbor Shoulder Bag 26",
                      "brand": "Northwind",
                      "category": "Handbags",
                      "imageRefs": [
                        "images/northwind-harbor-detail.jpg"
                      ]
                    },
                    "identifiers": {
                      "gtin": "00400000000121",
                      "batchLot": "LOT-2026-0212",
                      "serial": "NW-26-0000001"
                    },
                    "origin": {
                      "assemblyCountry": "IT",
                      "stages": [
                        {
                          "stage": "dyeing_finishing",
                          "countryCode": "IT"
                        }
                      ],
                      "manufacturedOn": "2026-05-31"
                    },
                    "materials": [
                      {
                        "externalRef": "MAT-BODY",
                        "parentRef": null,
                        "componentName": "Body",
                        "materialName": "Full-grain cowhide leather",
                        "materialClass": "leather",
                        "massG": 640,
                        "massSharePct": 82,
                        "recycledContentPct": 0,
                        "hazardous": false,
                        "originCountry": "IT",
                        "processingStage": "dyeing_finishing",
                        "provenance": "brand_declared",
                        "certificateRef": null,
                        "componentKind": "product",
                        "disposalInstruction": null
                      }
                    ],
                    "care": "Wipe with a soft, dry cloth. Avoid prolonged exposure to direct sunlight and moisture. Store in the dust bag.",
                    "durability": [
                      {
                        "metric": "abrasion",
                        "value": "Grade 5 (ISO 12947-2)",
                        "standardRef": "ISO 12947-2"
                      }
                    ],
                    "repairability": {
                      "score": 8.9,
                      "summary": "Repairable for life through Northwind repair counters. Hardware, straps, and lining are all replaceable.",
                      "sparePartsUrl": "https://www.example.com/repair-counter",
                      "disassemblySteps": [
                        "Remove the shoulder strap at both swivel clips."
                      ],
                      "disassemblyTools": [
                        "PH0 screwdriver"
                      ]
                    },
                    "circularity": {
                      "recyclabilityRoute": "Leather body is repurposable through Northwind Second Life; hardware is recyclable as brass once separated.",
                      "takebackSchemeName": "Northwind Second Life",
                      "takebackUrl": "https://www.example.com/second-life",
                      "materialRoutes": [
                        {
                          "material": "Full-grain cowhide leather",
                          "route": "repurpose_second_life"
                        }
                      ],
                      "eprRegistrationNumber": "IT-EPR-2026-441207"
                    },
                    "impact": {
                      "carbonKgCo2e": 24.6,
                      "method": "ISO_14067",
                      "boundary": "cradle_to_grave",
                      "methodologyNote": "Cradle-to-grave footprint per ISO 14067, third-party reviewed. Excludes consumer-phase care.",
                      "waterM3": null,
                      "energyKwh": null
                    },
                    "substances": {
                      "containsSvhc": false,
                      "declarationMade": true,
                      "items": [
                        {
                          "substanceName": "Chromium VI",
                          "casNumber": "18540-29-9",
                          "aboveThreshold": false,
                          "safeUseInstructions": "Chrome-free vegetable tannage; Cr(VI) not detected at a 3 mg/kg limit of quantification.",
                          "ecNumber": "242-403-9",
                          "regulation": "REACH_ANNEX_XVII",
                          "concentrationPpm": 0,
                          "scipRef": null
                        }
                      ]
                    },
                    "certifications": [
                      {
                        "standardRef": "LWG Gold",
                        "issuer": "Leather Working Group",
                        "validUntil": "2027-12-31"
                      }
                    ],
                    "lifecycle": [
                      {
                        "eventType": "manufactured",
                        "on": "2026-05-31T09:18:14.478+00:00",
                        "countryCode": "IT",
                        "actorKind": "manufacturer",
                        "actorName": "Pelletteria Toscana S.r.l."
                      }
                    ],
                    "compliance": {
                      "registryRef": null,
                      "completenessScore": 91.75,
                      "rulesetVersion": "2026.08-textile-v1",
                      "sections": [
                        {
                          "section": "materials",
                          "label": "Materials & composition",
                          "score": 100,
                          "met": 7,
                          "total": 7
                        }
                      ],
                      "gaps": [
                        {
                          "id": "supply_chain.tier1",
                          "label": "Tier-1 supplier linked",
                          "severity": "required"
                        }
                      ]
                    },
                    "version": 0,
                    "publishedAt": "2026-11-21T10:54:58.078597+00:00",
                    "documents": [
                      {
                        "documentRef": "DOC-BOL-5521",
                        "kind": "other",
                        "title": "Bill of lading 5521",
                        "issuer": null,
                        "standardRef": null,
                        "validUntil": null
                      }
                    ],
                    "economicOperator": {
                      "legalName": "Northwind Europe Services B.V.",
                      "eori": "NL000000001",
                      "registeredAddress": "Voorbeeldstraat 1, 1000 AA Amsterdam, Netherlands",
                      "contactEmail": "planner@example.com"
                    },
                    "manufacturing": {
                      "facilityExternalId": "FAC-IT-0112",
                      "facilityCountry": "IT"
                    },
                    "suppliers": [],
                    "profile": "textile",
                    "packaging": [],
                    "food": null,
                    "appliance": null,
                    "certificationClaims": [],
                    "inheritance": null
                  },
                  "completeness": {
                    "score": 91.75,
                    "sections": [
                      {
                        "section": "materials",
                        "label": "Materials & composition",
                        "score": 100,
                        "met": 7,
                        "total": 7,
                        "weight": 22
                      }
                    ],
                    "gaps": [
                      {
                        "id": "supply_chain.tier1",
                        "label": "Tier-1 supplier linked",
                        "section": "supply_chain",
                        "sectionLabel": "Supply chain",
                        "severity": "required",
                        "weight": 4,
                        "remediation": "Link the tier-1 manufacturer from your supplier master.",
                        "regulationRefs": [
                          "ESPR 2024/1781 Art.9"
                        ]
                      }
                    ],
                    "blockingGaps": 0,
                    "requiredGaps": 1,
                    "applicable": 39,
                    "met": 34,
                    "rulesetVersion": "2026.08-textile-v1",
                    "profile": "textile",
                    "regulatoryStatus": "espr_preparation"
                  },
                  "digital_link": "https://files.example.com/p/01/00400000000121/10/LOT-2026-0212/21/NW-26-0000001",
                  "model_passport": null,
                  "erp_fill": null,
                  "request_id": "35dfb313-f6eb-4e45-bd27-5331410ea5c3"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      },
      "patch": {
        "operationId": "updatePassport",
        "summary": "Update a passport's fields: at least one is required. Sending public_enabled also needs the execute scope, and then the key's creator must still be a member",
        "description": "Key scope: ingest. Module: dpp. 409 gtin_owned_elsewhere: another organization publishes passports for this GTIN; 409 gtin_public_elsewhere: another public passport already uses this GTIN and lot or serial",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "The product's name: a string (read as English), or one string per language, keyed by language tag (en, fr, pt-BR)"
                  },
                  "brand": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200,
                    "description": "null clears it"
                  },
                  "category": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200,
                    "description": "null clears it"
                  },
                  "public_enabled": {
                    "type": "boolean",
                    "description": "Whether the published passport can be opened by anyone with its link"
                  },
                  "gtin": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^([0-9]{8}|[0-9]{12,14})$",
                    "description": "GTIN-8, 12, 13 or 14: digits only, with a valid check digit. Returned as 14 digits. null clears it"
                  },
                  "batch_lot": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 20,
                    "pattern": "^[A-Za-z0-9!\"%&'()*+,./:;<=>?_-]+$",
                    "description": "Batch or lot number: letters, digits and ! \" % & ' ( ) * + , - . / : ; < = > ? _ (no spaces). null clears it"
                  },
                  "serial": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 20,
                    "pattern": "^[A-Za-z0-9!\"%&'()*+,./:;<=>?_-]+$",
                    "description": "Serial number: letters, digits and ! \" % & ' ( ) * + , - . / : ; < = > ? _ (no spaces). null clears it"
                  },
                  "draft_data": {
                    "type": "object",
                    "description": "Passport content beyond the fields above, merged key by key over what is stored (a key you send replaces that key whole; null removes it). Validated against the passport's profile: a key the profile does not have, or a malformed value, is a 400 with field errors. Keys: economic_operator {legal_name, eori, registered_address, contact_email}, manufacturing {facility_external_id, facility_country, assembly_country, manufactured_on}, stage_origins [{stage, country_code, facility_external_id}], care_instructions (a string or one per language), durability [{metric, value, standard_ref}], repairability {score, summary, spare_parts_url, disassembly_steps[], disassembly_tools[]}, circularity {recyclability_route, material_routes [{material, route}], takeback_scheme_name, takeback_url, epr_registration_number}, impact {carbon_kg_co2e, method, boundary, water_m3, energy_kwh, methodology_note}, svhc_declaration_made (boolean), image_urls [] (https), certifications [{scheme, certificate_number, holder_name, valid_until, document_external_id}], food {net_quantity {value, unit}, harvest_year, process, production_date, production_site {name, country, facility_external_id}, best_before, allergen_statement, contains_allergens, ingredient_statement} (food profiles), appliance {model_identifier, manufacturer {name, address}, importer {name, address}, energy_label {energy_class, label_url, registration_ref, notes}, weee {producer_registration_number, takeback_url, instructions}} (appliance profile)"
                  },
                  "profile": {
                    "type": "string",
                    "enum": [
                      "textile",
                      "leather_goods",
                      "food_coffee",
                      "food_general",
                      "appliance",
                      "general"
                    ],
                    "description": "The product profile, which picks the rule set: textile, leather_goods, food_coffee (voluntary: ESPR excludes food), food_general, appliance (guidance) or general"
                  },
                  "eu_market": {
                    "type": "boolean",
                    "description": "Whether the product is placed on the EU market"
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              },
              "example": {
                "category": "Tops",
                "draft_data": {
                  "care_instructions": "Machine wash cold. Do not tumble dry.",
                  "manufacturing": {
                    "facility_country": "VN",
                    "assembly_country": "VN",
                    "manufactured_on": "2026-10-12"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "passport": {
                      "$ref": "#/components/schemas/Passport"
                    },
                    "completeness": {
                      "$ref": "#/components/schemas/PassportCompleteness"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "passport",
                    "completeness",
                    "request_id"
                  ]
                },
                "example": {
                  "passport": {
                    "id": "5f042be4-0cce-4a7f-ab93-bbcb8c35ef81",
                    "org_id": "4fc7a944-6245-4491-b6af-694bd6bd14cf",
                    "external_id": "TOTE-MAT-00000023",
                    "granularity": "model",
                    "item_id": "221641ba-5901-43de-bacd-998771b3a578",
                    "variant_id": null,
                    "lot_id": null,
                    "tracked_unit_id": null,
                    "item_external_id": "MAT-00000023",
                    "lot_external_id": null,
                    "gtin": "00012345678905",
                    "batch_lot": null,
                    "serial": null,
                    "title": {
                      "en": "Canvas tote",
                      "fr": "Cabas en toile"
                    },
                    "brand": "Northwind Atelier",
                    "category": "Handbags",
                    "status": "draft",
                    "published_version_id": null,
                    "draft_data": {
                      "impact": {
                        "water_m3": 0.4,
                        "energy_kwh": 3.2
                      },
                      "durability": [
                        {
                          "value": "Grade 5",
                          "metric": "abrasion",
                          "standard_ref": "ISO 12947-2"
                        }
                      ],
                      "image_urls": [
                        "images/canvas-tote-front.jpg"
                      ],
                      "circularity": {
                        "takeback_url": "https://example.com/takeback",
                        "material_routes": [
                          {
                            "route": "metal_recycling",
                            "material": "Brass"
                          }
                        ],
                        "recyclability_route": {
                          "en": "Leather is repurposable; hardware is recyclable."
                        },
                        "takeback_scheme_name": "Take-back",
                        "epr_registration_number": "IT-EPR-0001"
                      },
                      "manufacturing": {
                        "assembly_country": "IT",
                        "facility_country": "IT",
                        "facility_external_id": "FAC-IT-0001"
                      },
                      "repairability": {
                        "score": 8,
                        "summary": {
                          "en": "Straps and hardware are replaceable."
                        },
                        "spare_parts_url": "https://example.com/spares",
                        "disassembly_steps": [
                          "Unclip the strap."
                        ],
                        "disassembly_tools": [
                          "Screwdriver"
                        ]
                      },
                      "stage_origins": [
                        {
                          "stage": "fibre",
                          "country_code": "IT"
                        }
                      ],
                      "care_instructions": {
                        "en": "Wipe with a soft, dry cloth."
                      }
                    },
                    "completeness_score": 5.88,
                    "compliance_state": "incomplete",
                    "ruleset_version": "2026.08-textile-v1",
                    "public_enabled": false,
                    "registry_ref": null,
                    "created_at": "2026-11-21T10:55:55.212128+00:00",
                    "updated_at": "2026-11-21T10:55:55.240945+00:00",
                    "profile": "textile",
                    "model_passport_id": null,
                    "eu_market": false
                  },
                  "completeness": {
                    "score": 45.88,
                    "sections": [
                      {
                        "section": "materials",
                        "label": "Materials & composition",
                        "score": 0,
                        "met": 0,
                        "total": 6,
                        "weight": 20
                      }
                    ],
                    "gaps": [
                      {
                        "id": "materials.composition_present",
                        "label": "Fibre composition declared",
                        "section": "materials",
                        "sectionLabel": "Materials & composition",
                        "severity": "blocking",
                        "weight": 5,
                        "remediation": "Add at least one material with its share of total mass.",
                        "regulationRefs": [
                          "Reg. (EU) 1007/2011 Art.14"
                        ]
                      }
                    ],
                    "blockingGaps": 2,
                    "requiredGaps": 10,
                    "applicable": 34,
                    "met": 17,
                    "rulesetVersion": "2026.08-textile-v1",
                    "profile": "textile",
                    "regulatoryStatus": "espr_preparation"
                  },
                  "request_id": "236c9e98-0048-44d9-8e42-34ea95befa49"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/batches": {
      "post": {
        "operationId": "createBatchPassports",
        "summary": "Create batch passports for the lots of a model passport's item that have none (idempotent), each filled from its lot's ERP data; at most 200 a call",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lot_external_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "pattern": "^[A-Za-z0-9_.:@/-]+$"
                    },
                    "maxItems": 200,
                    "description": "Only these lots; omitted: every lot without a batch passport"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "default": 200
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "limit": 50
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "lot_external_id": {
                            "type": "string"
                          },
                          "published": {
                            "type": "boolean",
                            "description": "Published automatically (the organization's setting, a published model, nothing blocking)"
                          },
                          "notes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "id",
                          "external_id",
                          "lot_external_id",
                          "published",
                          "notes"
                        ]
                      }
                    },
                    "skipped": {
                      "type": "integer",
                      "description": "Lots that already had a batch passport (or got one at the same moment)"
                    },
                    "remaining": {
                      "type": "integer",
                      "description": "Lots without a batch passport past this call's limit: call again"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "created",
                    "skipped",
                    "remaining",
                    "request_id"
                  ]
                },
                "example": {
                  "created": [
                    {
                      "id": "5c7e2b1a-9d4f-4a3e-8b6c-1f2e3d4c5b6a",
                      "external_id": "DPP-BLEND-1KG-LOT-R-2026-1120",
                      "lot_external_id": "R-2026-1120",
                      "published": false,
                      "notes": [
                        "Origins: 3 countries from the lot genealogy.",
                        "Roast date 2026-11-20 from the roast transformation.",
                        "Best-before 2027-11-20 from the lot's expiry date."
                      ]
                    }
                  ],
                  "skipped": 4,
                  "remaining": 0,
                  "request_id": "1b3d5f70-2a4c-4e6b-8d0f-9a1b2c3d4e5f"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/completeness": {
      "get": {
        "operationId": "getPassportCompleteness",
        "summary": "A passport's completeness score, its gaps and the requirement checklist",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "completeness": {
                      "$ref": "#/components/schemas/PassportCompleteness"
                    },
                    "checklist": {
                      "type": "object",
                      "properties": {
                        "profile": {
                          "type": "string",
                          "enum": [
                            "textile",
                            "leather_goods",
                            "food_coffee",
                            "food_general",
                            "appliance",
                            "general"
                          ],
                          "description": "The product profile the passport is scored against"
                        },
                        "regulatoryStatus": {
                          "type": "string",
                          "enum": [
                            "espr_preparation",
                            "voluntary",
                            "guidance",
                            "minimal"
                          ],
                          "description": "espr_preparation: textile and leather (the ESPR textile act is not final); voluntary: food, which ESPR excludes; guidance: appliances; minimal: general"
                        },
                        "version": {
                          "type": "string"
                        },
                        "effectiveDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "basis": {
                          "type": "string",
                          "description": "What the requirement set is based on"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "The requirement, for example identity.gtin"
                              },
                              "label": {
                                "type": "string"
                              },
                              "section": {
                                "type": "string",
                                "enum": [
                                  "identity",
                                  "materials",
                                  "substances",
                                  "circularity",
                                  "impact",
                                  "supply_chain",
                                  "compliance",
                                  "lifecycle"
                                ]
                              },
                              "sectionLabel": {
                                "type": "string"
                              },
                              "severity": {
                                "type": "string",
                                "enum": [
                                  "blocking",
                                  "required",
                                  "recommended"
                                ],
                                "description": "blocking: the passport cannot be published without it; required: expected; recommended: good practice"
                              },
                              "weight": {
                                "type": "number",
                                "description": "The requirement's share of the 0 to 100 score"
                              },
                              "remediation": {
                                "type": "string",
                                "description": "What to do to meet it"
                              },
                              "regulationRefs": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "passed": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "label",
                              "section",
                              "sectionLabel",
                              "severity",
                              "weight",
                              "remediation",
                              "regulationRefs",
                              "passed"
                            ]
                          }
                        },
                        "passed": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "profile",
                        "regulatoryStatus",
                        "version",
                        "effectiveDate",
                        "basis",
                        "items",
                        "passed",
                        "total"
                      ]
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "completeness",
                    "checklist",
                    "request_id"
                  ]
                },
                "example": {
                  "completeness": {
                    "score": 91.75,
                    "sections": [
                      {
                        "section": "materials",
                        "label": "Materials & composition",
                        "score": 100,
                        "met": 7,
                        "total": 7,
                        "weight": 22
                      }
                    ],
                    "gaps": [
                      {
                        "id": "supply_chain.tier1",
                        "label": "Tier-1 supplier linked",
                        "section": "supply_chain",
                        "sectionLabel": "Supply chain",
                        "severity": "required",
                        "weight": 4,
                        "remediation": "Link the tier-1 manufacturer from your supplier master.",
                        "regulationRefs": [
                          "ESPR 2024/1781 Art.9"
                        ]
                      }
                    ],
                    "blockingGaps": 0,
                    "requiredGaps": 1,
                    "applicable": 39,
                    "met": 34,
                    "rulesetVersion": "2026.08-textile-v1",
                    "profile": "textile",
                    "regulatoryStatus": "espr_preparation"
                  },
                  "checklist": {
                    "version": "2026.08-textile-v1",
                    "effectiveDate": "2026-08-04",
                    "basis": "Based on ESPR (EU) 2024/1781, Textile Labelling (EU) 1007/2011, REACH/SCIP, and CIRPASS guidance. The ESPR textile delegated act is not y...",
                    "items": [
                      {
                        "id": "circularity.care_instructions",
                        "label": "Care instructions",
                        "section": "circularity",
                        "sectionLabel": "Circularity & repair",
                        "severity": "blocking",
                        "weight": 4,
                        "passed": true,
                        "remediation": "Add washing, drying, and care guidance.",
                        "regulationRefs": [
                          "Reg. (EU) 1007/2011"
                        ]
                      }
                    ],
                    "passed": 34,
                    "total": 39,
                    "profile": "textile",
                    "regulatoryStatus": "espr_preparation"
                  },
                  "request_id": "a7d38188-519e-4714-aa44-e16d8ec2087a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      }
    },
    "/v1/passports/{id}/custody": {
      "get": {
        "operationId": "listPassportCustody",
        "summary": "A passport's chain-of-custody transfers in order, with how much of the chain is documented",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `transfers`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportCustodyTransfer"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "transfers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportCustodyTransfer"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "coverage": {
                      "$ref": "#/components/schemas/PassportCustodyCoverage"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "transfers",
                    "coverage",
                    "request_id"
                  ]
                },
                "example": {
                  "transfers": [
                    {
                      "externalId": "OE:DOC-ORIGIN-01:1",
                      "fromParty": "Azienda Agricola Val d'Orcia",
                      "toParty": "Macello Senese S.r.l.",
                      "fromCountry": "IT",
                      "fromRegion": "IT-52",
                      "transferDate": "2026-01-02",
                      "description": "Ref DDT-01 · p.1 · from DOC-ORIGIN-01",
                      "materialExternalId": "MAT-BODY",
                      "supplierExternalId": null,
                      "quantity": 2400,
                      "uom": "kg",
                      "evidence": [
                        {
                          "documentExternalId": "DOC-ORIGIN-01",
                          "evidenceKind": "other"
                        }
                      ],
                      "updatedAt": "2026-11-21T09:43:46.322892+00:00"
                    }
                  ],
                  "coverage": {
                    "covered": 32,
                    "total": 33,
                    "gaps": [
                      {
                        "id": "transfer-unevidenced:XFER-FINISHED",
                        "label": "Transfer XFER-FINISHED has no supporting evidence document"
                      }
                    ],
                    "perTransfer": [
                      {
                        "externalId": "OE:DOC-ORIGIN-01:1",
                        "evidenceCount": 1,
                        "covered": true
                      }
                    ],
                    "originAnchored": true
                  },
                  "request_id": "f858c894-ae62-4fdf-ab28-c3a1658e7dd3",
                  "object": "list",
                  "data": [
                    {
                      "externalId": "OE:DOC-ORIGIN-01:1",
                      "fromParty": "Azienda Agricola Val d'Orcia",
                      "toParty": "Macello Senese S.r.l.",
                      "fromCountry": "IT",
                      "fromRegion": "IT-52",
                      "transferDate": "2026-01-02",
                      "description": "Ref DDT-01 · p.1 · from DOC-ORIGIN-01",
                      "materialExternalId": "MAT-BODY",
                      "supplierExternalId": null,
                      "quantity": 2400,
                      "uom": "kg",
                      "evidence": [
                        {
                          "documentExternalId": "DOC-ORIGIN-01",
                          "evidenceKind": "other"
                        }
                      ],
                      "updatedAt": "2026-11-21T09:43:46.322892+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "transfers"
        }
      },
      "put": {
        "operationId": "replacePassportCustody",
        "summary": "Replace chain-of-custody transfers. Transfers written from confirmed origin evidence are kept",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transfers": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "external_id",
                        "from_party",
                        "to_party",
                        "transfer_date"
                      ],
                      "properties": {
                        "external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "Your id for the transfer, unique in the list"
                        },
                        "from_party": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "to_party": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "transfer_date": {
                          "type": "string",
                          "format": "date"
                        },
                        "from_country": {
                          "type": "string",
                          "pattern": "^[A-Za-z]{2}$",
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "material_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$"
                        },
                        "supplier_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$"
                        },
                        "evidence": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "document_external_id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "pattern": "^[A-Za-z0-9_.:@/-]+$",
                                "description": "A document of this passport"
                              },
                              "evidence_kind": {
                                "type": "string",
                                "enum": [
                                  "purchase_order",
                                  "invoice",
                                  "bill_of_lading",
                                  "packing_list",
                                  "certificate",
                                  "other"
                                ]
                              }
                            },
                            "required": [
                              "document_external_id",
                              "evidence_kind"
                            ],
                            "additionalProperties": true
                          },
                          "maxItems": 20
                        }
                      }
                    },
                    "maxItems": 500,
                    "description": "The whole list; an empty one removes every transfer"
                  }
                },
                "required": [
                  "transfers"
                ],
                "additionalProperties": false
              },
              "example": {
                "transfers": [
                  {
                    "external_id": "TR-1",
                    "from_party": "Northwind Textiles Ltd",
                    "to_party": "Harbor Outfitters Inc",
                    "transfer_date": "2026-10-20",
                    "from_country": "VN",
                    "material_external_id": "MAT-BODY",
                    "evidence": [
                      {
                        "document_external_id": "DOC-BOL-1",
                        "evidence_kind": "bill_of_lading"
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transfers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportCustodyTransferWritten"
                      }
                    },
                    "coverage": {
                      "$ref": "#/components/schemas/PassportCustodyCoverage"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "transfers",
                    "coverage",
                    "request_id"
                  ]
                },
                "example": {
                  "transfers": [
                    {
                      "externalId": "XFER-1",
                      "fromParty": "Azienda Agricola Esempio",
                      "toParty": "Conceria Esempio S.p.A.",
                      "fromCountry": "IT",
                      "fromRegion": null,
                      "transferDate": "2026-01-12",
                      "description": "Raw hides",
                      "materialExternalId": "MAT-BODY",
                      "supplierExternalId": null,
                      "quantity": 1200,
                      "uom": "kg",
                      "evidence": [
                        {
                          "documentExternalId": "DOC-TANNERY-DECLARATION",
                          "evidenceKind": "certificate"
                        }
                      ]
                    }
                  ],
                  "coverage": {
                    "covered": 1,
                    "total": 2,
                    "gaps": [
                      {
                        "id": "transfer-unevidenced:XFER-2",
                        "label": "Transfer XFER-2 has no supporting evidence document"
                      }
                    ],
                    "perTransfer": [
                      {
                        "externalId": "XFER-1",
                        "evidenceCount": 1,
                        "covered": true
                      }
                    ],
                    "originAnchored": true
                  },
                  "request_id": "05dd0838-ea35-43ea-860c-768d73ca025f"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/dds_references": {
      "put": {
        "operationId": "replacePassportDdsReferences",
        "summary": "Replace a passport's Due Diligence Statement reference numbers (stored only, never submitted)",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "references": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "reference_number": {
                          "type": "string",
                          "maxLength": 100,
                          "description": "The Due Diligence Statement reference number"
                        },
                        "verification_number": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "note": {
                          "type": "string",
                          "maxLength": 500
                        }
                      },
                      "required": [
                        "reference_number"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "description": "The whole list; an empty one removes every reference. Stored only: nothing is submitted to the EU information system"
                  }
                },
                "required": [
                  "references"
                ],
                "additionalProperties": false
              },
              "example": {
                "references": [
                  {
                    "reference_number": "25FRXXXXXXXXXX",
                    "verification_number": "ABCD1234",
                    "note": "Filed by the EU importer of record"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "references": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "reference_number": {
                            "type": "string"
                          },
                          "verification_number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "reference_number",
                          "verification_number",
                          "note"
                        ]
                      }
                    },
                    "submission": {
                      "type": "string",
                      "description": "A reminder that references are stored only and nothing is submitted to the EU information system"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "references",
                    "submission",
                    "request_id"
                  ]
                },
                "example": {
                  "references": [
                    {
                      "reference_number": "25FRXXXXXXXXXX",
                      "verification_number": "ABCD1234",
                      "note": "Filed by the EU importer of record"
                    }
                  ],
                  "submission": "Stored only. InsightChain does not submit Due Diligence Statements to the EU information system.",
                  "request_id": "8a2d4f61-0c3b-4e5a-9b7d-2f1e6c3a8b90"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/documents": {
      "get": {
        "operationId": "listPassportDocuments",
        "summary": "A passport's documents, each with a short-lived download link",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `documents`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportDocument"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "documents": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportDocument"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "documents",
                    "request_id"
                  ]
                },
                "example": {
                  "documents": [
                    {
                      "id": "0a44779d-8986-4207-a00c-83b3da75210c",
                      "external_id": "DOC-BOL-5521",
                      "kind": "other",
                      "title": "Bill of lading 5521",
                      "issuer": null,
                      "standard_ref": null,
                      "valid_from": null,
                      "valid_until": null,
                      "min_audience": "internal",
                      "size_bytes": 125,
                      "content_type": "application/pdf",
                      "url": "https://files.example.com/passports/documents/declaration-of-origin.pdf?token=example-token"
                    }
                  ],
                  "request_id": "064690d7-ee5b-4012-9686-e4cd4b424eb8",
                  "object": "list",
                  "data": [
                    {
                      "id": "0a44779d-8986-4207-a00c-83b3da75210c",
                      "external_id": "DOC-BOL-5521",
                      "kind": "other",
                      "title": "Bill of lading 5521",
                      "issuer": null,
                      "standard_ref": null,
                      "valid_from": null,
                      "valid_until": null,
                      "min_audience": "internal",
                      "size_bytes": 125,
                      "content_type": "application/pdf",
                      "url": "https://files.example.com/passports/documents/declaration-of-origin.pdf?token=example-token"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "documents"
        }
      },
      "post": {
        "operationId": "createPassportDocument",
        "summary": "Register a document and get a signed upload URL",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "external_id",
                  "kind",
                  "title",
                  "content_type",
                  "size_bytes"
                ],
                "properties": {
                  "external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$",
                    "description": "Your id for the document; sending it again replaces the document: upload the file again to the new URL"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "certificate",
                      "test_report",
                      "declaration_of_conformity",
                      "care_label",
                      "image",
                      "repair_manual",
                      "disassembly_guide",
                      "other"
                    ],
                    "description": "The kind of document"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "application/pdf",
                      "image/png",
                      "image/jpeg",
                      "image/webp",
                      "text/plain"
                    ],
                    "description": "The media type of the file you will upload"
                  },
                  "size_bytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10485760,
                    "description": "The file's size in bytes"
                  },
                  "min_audience": {
                    "type": "string",
                    "enum": [
                      "consumer",
                      "recycler",
                      "authority",
                      "internal"
                    ],
                    "default": "authority",
                    "description": "Who may see it"
                  },
                  "issuer": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "standard_ref": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "valid_from": {
                    "type": "string",
                    "format": "date"
                  },
                  "valid_until": {
                    "type": "string",
                    "format": "date",
                    "description": "On or after valid_from"
                  }
                }
              },
              "example": {
                "external_id": "DOC-CERT-1",
                "kind": "certificate",
                "title": "Organic content certificate",
                "content_type": "application/pdf",
                "size_bytes": 482113,
                "issuer": "Independent certification body",
                "valid_from": "2026-01-01",
                "valid_until": "2026-12-31"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "document": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "certificate",
                            "test_report",
                            "declaration_of_conformity",
                            "care_label",
                            "image",
                            "repair_manual",
                            "disassembly_guide",
                            "other"
                          ]
                        },
                        "title": {
                          "type": "string"
                        },
                        "min_audience": {
                          "type": "string",
                          "enum": [
                            "consumer",
                            "recycler",
                            "authority",
                            "internal"
                          ],
                          "description": "The least-privileged audience that may see it"
                        }
                      },
                      "required": [
                        "id",
                        "external_id",
                        "kind",
                        "title",
                        "min_audience"
                      ]
                    },
                    "upload_url": {
                      "type": "string",
                      "description": "PUT the file here; the link is short-lived"
                    },
                    "upload_token": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "document",
                    "upload_url",
                    "upload_token",
                    "request_id"
                  ]
                },
                "example": {
                  "document": {
                    "id": "a6b60424-2a56-4a4b-8534-c8f4002779c0",
                    "external_id": "DOC-TANNERY-DECLARATION",
                    "kind": "certificate",
                    "title": "Tannery declaration of origin",
                    "min_audience": "authority"
                  },
                  "upload_url": "https://files.example.com/passports/uploads/declaration-of-origin.pdf?token=example-token",
                  "upload_token": "shown-once-example-value",
                  "request_id": "4e442d4d-17cc-4f71-8b04-82e4a14d2075"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/documents/{document_id}/verify": {
      "post": {
        "operationId": "verifyPassportDocument",
        "summary": "After uploading a document's file: compute its sha256 and check its real type against the declared one (a mismatch removes the file, 422)",
        "description": "Key scope: ingest. Module: dpp. 422: the file's content did not match its declared type or size and was removed; 409: the file has not been uploaded yet",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The document's external id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "document": {
                      "type": "object",
                      "properties": {
                        "external_id": {
                          "type": "string"
                        },
                        "verification_status": {
                          "type": "string",
                          "enum": [
                            "verified",
                            "rejected",
                            "pending"
                          ]
                        },
                        "sha256": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "external_id",
                        "verification_status",
                        "sha256"
                      ]
                    },
                    "reason": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "document",
                    "reason",
                    "request_id"
                  ]
                },
                "example": {
                  "document": {
                    "external_id": "DOC-CERT-1",
                    "verification_status": "verified",
                    "sha256": "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
                  },
                  "reason": "match",
                  "request_id": "4d6f8b01-5c7e-4a9b-8d2f-3e4a5b6c7d8e"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/erp_fill": {
      "post": {
        "operationId": "fillPassportFromErp",
        "summary": "Fill a batch passport again from its lot's ERP data: origin shares, roast or production date and site, best-before, lot certificates",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "passport": {
                      "$ref": "#/components/schemas/Passport"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "completeness": {
                      "$ref": "#/components/schemas/PassportCompleteness"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "passport",
                    "notes",
                    "completeness",
                    "request_id"
                  ]
                },
                "example": {
                  "passport": {
                    "id": "f76d228e-6ab6-4c1b-b5b1-30266d2ebc98",
                    "org_id": "4fc7a944-6245-4491-b6af-694bd6bd14cf",
                    "external_id": "NORTHWIND-HARBOR26-NH2601",
                    "granularity": "batch",
                    "item_id": "612b1c85-2ce5-4953-8eab-5963ad7e1201",
                    "variant_id": null,
                    "lot_id": "e886ef53-5a6a-436b-a99c-44bdeaa13cd7",
                    "tracked_unit_id": "e545efc5-c959-485f-9d5b-1c608116e801",
                    "item_external_id": "NH2601",
                    "lot_external_id": "LOT-2026-0212",
                    "gtin": "00400000000121",
                    "batch_lot": "LOT-2026-0212",
                    "serial": "NW-26-0000001",
                    "title": {
                      "en": "Harbor Shoulder Bag 26",
                      "fr": "Sac porté épaule Harbor 26"
                    },
                    "brand": "Northwind",
                    "category": "Handbags",
                    "status": "published",
                    "published_version_id": "a866f7a4-0b87-49e4-b531-d1c9c2f01e75",
                    "draft_data": {
                      "impact": {
                        "method": "ISO_14067",
                        "boundary": "cradle_to_grave",
                        "water_m3": null,
                        "energy_kwh": null,
                        "carbon_kg_co2e": 24.6,
                        "methodology_note": "Cradle-to-grave footprint per ISO 14067, third-party reviewed. Excludes consumer-phase care."
                      },
                      "durability": [
                        {
                          "value": "Grade 5 (ISO 12947-2)",
                          "metric": "abrasion",
                          "standard_ref": "ISO 12947-2"
                        }
                      ],
                      "image_urls": [
                        "images/northwind-harbor-front.jpg"
                      ],
                      "circularity": {
                        "takeback_url": "https://www.example.com/second-life",
                        "material_routes": [
                          {
                            "route": "repurpose_second_life",
                            "material": "Full-grain cowhide leather"
                          }
                        ],
                        "recyclability_route": {
                          "en": "Leather body is repurposable through Northwind Second Life; hardware is recyclable as brass once separated."
                        },
                        "takeback_scheme_name": "Northwind Second Life",
                        "epr_registration_number": "IT-EPR-2026-441207"
                      },
                      "manufacturing": {
                        "assembly_country": "IT",
                        "facility_country": "IT",
                        "facility_external_id": "FAC-IT-0112"
                      },
                      "repairability": {
                        "score": 8.9,
                        "summary": {
                          "en": "Repairable for life through Northwind repair counters. Hardware, straps, and lining are all replaceable."
                        },
                        "spare_parts_url": "https://www.example.com/repair-counter",
                        "disassembly_steps": [
                          "Remove the shoulder strap at both swivel clips."
                        ],
                        "disassembly_tools": [
                          "PH0 screwdriver"
                        ]
                      },
                      "stage_origins": [
                        {
                          "stage": "fibre",
                          "country_code": "IT",
                          "facility_external_id": "FAC-IT-0044"
                        }
                      ],
                      "care_instructions": {
                        "en": "Wipe with a soft, dry cloth. Avoid prolonged exposure to direct sunlight and moisture. Store in the dust bag.",
                        "fr": "Essuyer avec un chiffon doux et sec. Éviter l'exposition prolongée au soleil et à l'humidité."
                      }
                    },
                    "completeness_score": 91.75,
                    "compliance_state": "incomplete",
                    "ruleset_version": "2026.08-textile-v1",
                    "public_enabled": true,
                    "registry_ref": null,
                    "created_at": "2026-11-21T09:18:15.073974+00:00",
                    "updated_at": "2026-11-21T10:54:58.078597+00:00",
                    "profile": "food_coffee",
                    "model_passport_id": "022736fc-32ba-4de3-9d49-e0271d238003",
                    "eu_market": false
                  },
                  "notes": [
                    "Origins: 3 countries from the lot genealogy.",
                    "Roast date 2026-11-20 from the roast transformation."
                  ],
                  "completeness": {
                    "score": 91.75,
                    "sections": [
                      {
                        "section": "materials",
                        "label": "Materials & composition",
                        "score": 100,
                        "met": 7,
                        "total": 7,
                        "weight": 22
                      }
                    ],
                    "gaps": [
                      {
                        "id": "supply_chain.tier1",
                        "label": "Tier-1 supplier linked",
                        "section": "supply_chain",
                        "sectionLabel": "Supply chain",
                        "severity": "required",
                        "weight": 4,
                        "remediation": "Link the tier-1 manufacturer from your supplier master.",
                        "regulationRefs": [
                          "ESPR 2024/1781 Art.9"
                        ]
                      }
                    ],
                    "blockingGaps": 0,
                    "requiredGaps": 1,
                    "applicable": 39,
                    "met": 34,
                    "rulesetVersion": "2026.11-food-coffee-v1",
                    "profile": "food_coffee",
                    "regulatoryStatus": "voluntary"
                  },
                  "request_id": "3c5e7a90-4b6d-4f8a-9c1e-2d3f4a5b6c7d"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/eudr_plots": {
      "get": {
        "operationId": "listPassportEudrPlots",
        "summary": "A passport's EUDR plots, the plots of its lot and green lots, its DDS references, and whether it is ready",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `plots`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportEudrPlot"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "plots": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportEudrPlot"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "lot_plots": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportEudrLotPlot"
                      },
                      "description": "Plots of the passport's lot and the green lots it was made from"
                    },
                    "dds_references": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportDdsReference"
                      }
                    },
                    "lot_dds_references": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lot_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "reference_number": {
                            "type": "string"
                          },
                          "verification_number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "recorded_by": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "lot_id",
                          "reference_number",
                          "verification_number",
                          "note",
                          "recorded_by",
                          "created_at"
                        ]
                      }
                    },
                    "eu_market": {
                      "type": "boolean"
                    },
                    "readiness": {
                      "$ref": "#/components/schemas/PassportEudrReadiness"
                    },
                    "submission": {
                      "type": "string",
                      "description": "A reminder that references are stored only and nothing is submitted to the EU information system"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "plots",
                    "lot_plots",
                    "dds_references",
                    "lot_dds_references",
                    "eu_market",
                    "readiness",
                    "submission",
                    "request_id"
                  ]
                },
                "example": {
                  "plots": [
                    {
                      "externalId": "OE:DOC-ORIGIN-01:plot:1",
                      "materialExternalId": "MAT-BODY",
                      "description": "Pasture A · p.2 · from DOC-ORIGIN-01",
                      "geometry": {
                        "type": "Point",
                        "coordinates": [
                          11.58,
                          43.07
                        ]
                      },
                      "areaHa": 2.8,
                      "producerCountry": "IT",
                      "commodity": "leather",
                      "submittedBySupplier": false,
                      "updatedAt": "2026-11-21T09:43:46.330602+00:00",
                      "producerName": null,
                      "producerId": null,
                      "deforestationFreeDeclaredBy": null,
                      "deforestationFreeDeclaredOn": null
                    }
                  ],
                  "readiness": {
                    "inScope": true,
                    "ready": true,
                    "gaps": [],
                    "plotCount": 17,
                    "coveredMaterials": [
                      "MAT-BODY"
                    ],
                    "uncoveredMaterials": [],
                    "commodities": [
                      "leather"
                    ],
                    "lotPlotCount": 0,
                    "euMarket": false,
                    "ddsReferenceCount": 0,
                    "plotsWithoutAttestation": 17
                  },
                  "request_id": "87de0552-6f27-47f5-9e3c-ad506ee2dfbe",
                  "object": "list",
                  "data": [
                    {
                      "externalId": "OE:DOC-ORIGIN-01:plot:1",
                      "materialExternalId": "MAT-BODY",
                      "description": "Pasture A · p.2 · from DOC-ORIGIN-01",
                      "geometry": {
                        "type": "Point",
                        "coordinates": [
                          11.58,
                          43.07
                        ]
                      },
                      "areaHa": 2.8,
                      "producerCountry": "IT",
                      "commodity": "leather",
                      "submittedBySupplier": false,
                      "updatedAt": "2026-11-21T09:43:46.330602+00:00",
                      "producerName": null,
                      "producerId": null,
                      "deforestationFreeDeclaredBy": null,
                      "deforestationFreeDeclaredOn": null
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "lot_plots": [],
                  "dds_references": [],
                  "lot_dds_references": [],
                  "eu_market": false,
                  "submission": "References are stored here only. InsightChain does not submit Due Diligence Statements to the EU information system."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "plots"
        }
      },
      "put": {
        "operationId": "replacePassportEudrPlots",
        "summary": "Replace EUDR plots. Plots written from confirmed origin evidence, and plots a supplier submitted, are kept",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plots": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "external_id",
                        "producer_country",
                        "commodity",
                        "geometry"
                      ],
                      "properties": {
                        "external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "Your id for the plot, unique in the list"
                        },
                        "producer_country": {
                          "type": "string",
                          "pattern": "^[A-Za-z]{2}$",
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "commodity": {
                          "type": "string",
                          "enum": [
                            "cattle",
                            "leather",
                            "wood",
                            "rubber",
                            "coffee",
                            "cocoa",
                            "palm_oil",
                            "soy"
                          ]
                        },
                        "geometry": {
                          "type": "object",
                          "description": "GeoJSON Point, Polygon or MultiPolygon in WGS-84. A Point needs area_ha, at most 4"
                        },
                        "area_ha": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000,
                          "description": "Required when geometry is a Point"
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 300
                        },
                        "producer_name": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "producer_id": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "deforestation_free_declared_by": {
                          "type": "string",
                          "maxLength": 200,
                          "description": "Who declared the plot was not deforested after 2020-12-31 (recorded, not checked)"
                        },
                        "deforestation_free_declared_on": {
                          "type": "string",
                          "format": "date",
                          "description": "When they declared it"
                        },
                        "material_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "The material of this passport the plot covers"
                        }
                      }
                    },
                    "maxItems": 500,
                    "description": "The whole list; an empty one removes every plot"
                  }
                },
                "required": [
                  "plots"
                ],
                "additionalProperties": false
              },
              "example": {
                "plots": [
                  {
                    "external_id": "PLOT-1",
                    "producer_country": "BR",
                    "commodity": "rubber",
                    "geometry": {
                      "type": "Point",
                      "coordinates": [
                        -51.2,
                        -10.4
                      ]
                    },
                    "area_ha": 3.2,
                    "description": "Smallholder plot, block A"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plots": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportEudrPlotWritten"
                      }
                    },
                    "readiness": {
                      "$ref": "#/components/schemas/PassportEudrReadiness"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "plots",
                    "readiness",
                    "request_id"
                  ]
                },
                "example": {
                  "plots": [
                    {
                      "externalId": "PLOT-FARM-A",
                      "materialExternalId": "MAT-BODY",
                      "description": "Farm A",
                      "geometry": {
                        "type": "Point",
                        "coordinates": [
                          11.25,
                          43.07
                        ]
                      },
                      "areaHa": 2.5,
                      "producerCountry": "IT",
                      "commodity": "leather",
                      "producerName": null,
                      "producerId": null,
                      "deforestationFreeDeclaredBy": null,
                      "deforestationFreeDeclaredOn": null
                    }
                  ],
                  "readiness": {
                    "inScope": true,
                    "ready": true,
                    "gaps": [],
                    "plotCount": 2,
                    "coveredMaterials": [
                      "MAT-BODY"
                    ],
                    "uncoveredMaterials": [],
                    "commodities": [
                      "leather"
                    ],
                    "lotPlotCount": 0,
                    "euMarket": false,
                    "ddsReferenceCount": 0,
                    "plotsWithoutAttestation": 2
                  },
                  "request_id": "8e1e9452-4b8c-426d-a9a9-fa293593ba15"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/eudr_plots/import": {
      "post": {
        "operationId": "importPassportEudrPlots",
        "summary": "Import EUDR plots from a GeoJSON FeatureCollection onto a passport (added or updated by external id; at most 500 plots per passport). Bad features are reported by index",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "feature_collection": {
                    "type": "object",
                    "description": "A GeoJSON FeatureCollection. Per feature: geometry (Point, Polygon, MultiPolygon) and properties external_id | plot_id | id, producer_country | country, commodity, area_ha | area, producer_name, producer_id, description | name, deforestation_free_declared_by, deforestation_free_declared_on"
                  },
                  "commodity": {
                    "type": "string",
                    "enum": [
                      "cattle",
                      "leather",
                      "wood",
                      "rubber",
                      "coffee",
                      "cocoa",
                      "palm_oil",
                      "soy"
                    ],
                    "description": "Used for features that name none"
                  },
                  "producer_country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "Used for features that name none"
                  }
                },
                "required": [
                  "feature_collection"
                ],
                "additionalProperties": false
              },
              "example": {
                "commodity": "coffee",
                "producer_country": "BR",
                "feature_collection": {
                  "type": "FeatureCollection",
                  "features": [
                    {
                      "type": "Feature",
                      "properties": {
                        "external_id": "FARM-001",
                        "producer_name": "Farm one",
                        "area_ha": 2.5,
                        "deforestation_free_declared_by": "Cooperative quality team",
                        "deforestation_free_declared_on": "2026-10-01"
                      },
                      "geometry": {
                        "type": "Point",
                        "coordinates": [
                          -45.12,
                          -21.24
                        ]
                      }
                    },
                    {
                      "type": "Feature",
                      "properties": {
                        "external_id": "FARM-002",
                        "producer_name": "Farm two"
                      },
                      "geometry": {
                        "type": "Polygon",
                        "coordinates": [
                          [
                            [
                              -45.2,
                              -21.3
                            ],
                            [
                              -45.19,
                              -21.3
                            ],
                            [
                              -45.19,
                              -21.29
                            ],
                            [
                              -45.2,
                              -21.3
                            ]
                          ]
                        ]
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "written": {
                      "type": "integer"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "externalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "issues": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "index",
                          "externalId",
                          "issues"
                        ]
                      },
                      "description": "Features that were not imported, by their index in the collection"
                    },
                    "readiness": {
                      "$ref": "#/components/schemas/PassportEudrReadiness"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "written",
                    "errors",
                    "readiness",
                    "request_id"
                  ]
                },
                "example": {
                  "written": 2,
                  "errors": [
                    {
                      "index": 2,
                      "externalId": "FARM-003",
                      "issues": [
                        "point_area_exceeds_4ha"
                      ]
                    }
                  ],
                  "readiness": {
                    "inScope": true,
                    "commodities": [
                      "coffee"
                    ],
                    "ready": true,
                    "gaps": [],
                    "plotCount": 2,
                    "lotPlotCount": 1,
                    "coveredMaterials": [
                      "ERP-ORIGIN-BR"
                    ],
                    "uncoveredMaterials": [],
                    "euMarket": false,
                    "ddsReferenceCount": 0,
                    "plotsWithoutAttestation": 0
                  },
                  "request_id": "6f1c2a90-4b3e-4d8a-9c21-3e7b5a1d0f42"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/events": {
      "get": {
        "operationId": "listPassportEvents",
        "summary": "A passport's lifecycle events, newest first",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `events`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportEvent"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportEvent"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "events",
                    "request_id"
                  ]
                },
                "example": {
                  "events": [
                    {
                      "id": "9034d4d6-ccdd-426b-a68a-a5ac8618197f",
                      "external_id": "EVT-RESOLD",
                      "event_type": "resold",
                      "occurred_at": "2026-10-26T09:18:14.478+00:00",
                      "actor_kind": "retailer",
                      "actor_name": "Northwind Second Life",
                      "country_code": "IT",
                      "min_audience": "consumer",
                      "details": {},
                      "source": "api"
                    }
                  ],
                  "request_id": "02986bc6-7100-472a-9985-d516e8137198",
                  "object": "list",
                  "data": [
                    {
                      "id": "9034d4d6-ccdd-426b-a68a-a5ac8618197f",
                      "external_id": "EVT-RESOLD",
                      "event_type": "resold",
                      "occurred_at": "2026-10-26T09:18:14.478+00:00",
                      "actor_kind": "retailer",
                      "actor_name": "Northwind Second Life",
                      "country_code": "IT",
                      "min_audience": "consumer",
                      "details": {},
                      "source": "api"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "events"
        }
      },
      "post": {
        "operationId": "createPassportEvent",
        "summary": "Add a lifecycle event",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "external_id",
                  "event_type",
                  "occurred_at"
                ],
                "properties": {
                  "external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$",
                    "description": "Your id for the event; sending it again updates the event"
                  },
                  "event_type": {
                    "type": "string",
                    "enum": [
                      "manufactured",
                      "quality_checked",
                      "shipped",
                      "received",
                      "sold",
                      "repaired",
                      "refurbished",
                      "resold",
                      "returned",
                      "recycled",
                      "disposed",
                      "recalled",
                      "inspected"
                    ],
                    "description": "The kind of lifecycle event"
                  },
                  "occurred_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "min_audience": {
                    "type": "string",
                    "enum": [
                      "consumer",
                      "recycler",
                      "authority",
                      "internal"
                    ],
                    "default": "consumer",
                    "description": "Who may see it"
                  },
                  "actor_kind": {
                    "type": "string",
                    "maxLength": 60
                  },
                  "actor_name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "country_code": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "ISO 3166-1 alpha-2 country code"
                  },
                  "location_external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$",
                    "description": "One of your locations; an unknown id is ignored"
                  },
                  "document_external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$"
                  },
                  "details": {
                    "type": "object",
                    "description": "Free-form details of the event"
                  }
                }
              },
              "example": {
                "external_id": "EVT-1001",
                "event_type": "manufactured",
                "occurred_at": "2026-10-12T08:00:00Z",
                "actor_kind": "manufacturer",
                "actor_name": "Northwind Textiles Ltd",
                "country_code": "VN"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "event": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "event_type": {
                          "type": "string",
                          "enum": [
                            "manufactured",
                            "quality_checked",
                            "shipped",
                            "received",
                            "sold",
                            "repaired",
                            "refurbished",
                            "resold",
                            "returned",
                            "recycled",
                            "disposed",
                            "recalled",
                            "inspected"
                          ]
                        },
                        "occurred_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "external_id",
                        "event_type",
                        "occurred_at"
                      ]
                    },
                    "completeness": {
                      "$ref": "#/components/schemas/PassportCompleteness"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "event",
                    "completeness",
                    "request_id"
                  ]
                },
                "example": {
                  "event": {
                    "id": "c9883d18-69b3-4233-b91b-d697dfe215fc",
                    "external_id": "EVT-MANUFACTURED",
                    "event_type": "manufactured",
                    "occurred_at": "2026-05-31T09:00:00+00:00"
                  },
                  "completeness": {
                    "score": 80,
                    "sections": [
                      {
                        "section": "materials",
                        "label": "Materials & composition",
                        "score": 81.82,
                        "met": 6,
                        "total": 7,
                        "weight": 22
                      }
                    ],
                    "gaps": [
                      {
                        "id": "impact.carbon_footprint",
                        "label": "Product carbon footprint",
                        "section": "impact",
                        "sectionLabel": "Environmental impact",
                        "severity": "required",
                        "weight": 5,
                        "remediation": "Add the product carbon footprint in kg CO2e.",
                        "regulationRefs": [
                          "ESPR 2024/1781 Annex I"
                        ]
                      }
                    ],
                    "blockingGaps": 0,
                    "requiredGaps": 4,
                    "applicable": 36,
                    "met": 28,
                    "rulesetVersion": "2026.08-textile-v1",
                    "profile": "textile",
                    "regulatoryStatus": "espr_preparation"
                  },
                  "request_id": "8a2881c1-5bf3-4d98-91b5-854fbf37ab2a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/impact_estimate": {
      "get": {
        "operationId": "getPassportImpactEstimate",
        "summary": "An estimated carbon footprint of the product, from the passport's bill of materials",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "estimate": {
                      "$ref": "#/components/schemas/PassportImpactEstimate"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "estimate",
                    "request_id"
                  ]
                },
                "example": {
                  "estimate": {
                    "basis": "industry_estimate",
                    "dataset": "uk-defra-ghg-conversion-factors",
                    "datasetVersion": "2026",
                    "license": "Open Government Licence v3.0 (attribution required)",
                    "attribution": "Contains public sector information licensed under the Open Government Licence v3.0. Source: UK Government GHG Conversion Factors for Company Reporting.",
                    "suppressedByMeasured": false,
                    "measuredCarbonKgCo2e": null,
                    "transport": {
                      "legs": [
                        {
                          "externalId": "TR-01",
                          "label": "Conceria Modello S.p.A. -> Northwind Atelier",
                          "estimate": null,
                          "na": "The transfer carries no transport mode or distance, so no transport estimate is made."
                        }
                      ],
                      "totalKgCo2e": null
                    },
                    "energy": {
                      "estimate": null,
                      "na": "No manufacturing energy is recorded on the passport."
                    },
                    "materials": {
                      "rows": [
                        {
                          "externalId": "MAT-BODY",
                          "materialName": "Full-grain cowhide leather",
                          "materialClass": "leather",
                          "estimate": {
                            "value": 11.9,
                            "unit": "kg CO2e",
                            "method": "0.7 kg of leather x 17.0 kg CO2e per kg",
                            "dataset": "uk-defra-ghg-conversion-factors",
                            "datasetVersion": "2026",
                            "factorId": "defra-2026/material/leather",
                            "basis": "industry_estimate",
                            "caution": "An industry average for the material class; the tannery's own process is not reflected."
                          },
                          "na": null
                        }
                      ],
                      "totalKgCo2e": {
                        "value": 11.9,
                        "unit": "kg CO2e",
                        "method": "Sum of the material rows",
                        "dataset": "uk-defra-ghg-conversion-factors",
                        "datasetVersion": "2026",
                        "factorId": "aggregate",
                        "basis": "industry_estimate",
                        "caution": "A sum of industry averages, not a measured footprint."
                      }
                    },
                    "total": {
                      "estimate": {
                        "value": 11.9,
                        "unit": "kg CO2e",
                        "method": "Materials only: transport and energy have no estimate",
                        "dataset": "uk-defra-ghg-conversion-factors",
                        "datasetVersion": "2026",
                        "factorId": "aggregate",
                        "basis": "industry_estimate",
                        "caution": "A partial total: it leaves out transport and manufacturing energy."
                      },
                      "na": null
                    },
                    "hasEstimates": true
                  },
                  "request_id": "d3b4caca-8dd6-4956-940e-71cd64c18901"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      }
    },
    "/v1/passports/{id}/materials": {
      "get": {
        "operationId": "listPassportMaterials",
        "summary": "A passport's bill of materials, including the rows its suppliers submitted",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `materials`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportMaterial"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "materials": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportMaterial"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "materials",
                    "request_id"
                  ]
                },
                "example": {
                  "materials": [
                    {
                      "externalId": "MAT-BODY",
                      "parentExternalId": null,
                      "sortOrder": 0,
                      "componentName": "Body",
                      "materialName": "Full-grain cowhide leather",
                      "materialClass": "leather",
                      "massG": 640,
                      "massSharePct": 82,
                      "recycledContentPct": 0,
                      "renewableContentPct": 100,
                      "hazardous": false,
                      "originCountry": "IT",
                      "processingStage": "dyeing_finishing",
                      "supplierRef": null,
                      "provenance": "brand_declared",
                      "certificateDocumentExternalId": null,
                      "componentKind": "product",
                      "disposalInstruction": null,
                      "originRegion": null,
                      "producerGroup": null,
                      "species": null
                    }
                  ],
                  "request_id": "39961bbb-0149-4aed-917e-3e3a6143f842",
                  "object": "list",
                  "data": [
                    {
                      "externalId": "MAT-BODY",
                      "parentExternalId": null,
                      "sortOrder": 0,
                      "componentName": "Body",
                      "materialName": "Full-grain cowhide leather",
                      "materialClass": "leather",
                      "massG": 640,
                      "massSharePct": 82,
                      "recycledContentPct": 0,
                      "renewableContentPct": 100,
                      "hazardous": false,
                      "originCountry": "IT",
                      "processingStage": "dyeing_finishing",
                      "supplierRef": null,
                      "provenance": "brand_declared",
                      "certificateDocumentExternalId": null,
                      "componentKind": "product",
                      "disposalInstruction": null,
                      "originRegion": null,
                      "producerGroup": null,
                      "species": null
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "materials"
        }
      },
      "put": {
        "operationId": "replacePassportMaterials",
        "summary": "Replace the bill of materials. Rows your suppliers submitted are kept",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "materials": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "external_id",
                        "material_name"
                      ],
                      "properties": {
                        "external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "Your id for the material, unique in the list"
                        },
                        "material_name": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "parent_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "A material of this list it is part of"
                        },
                        "component_name": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "material_class": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "sort_order": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000
                        },
                        "mass_g": {
                          "type": "number",
                          "minimum": 0
                        },
                        "mass_share_pct": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "recycled_content_pct": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "renewable_content_pct": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "hazardous": {
                          "type": "boolean",
                          "default": false
                        },
                        "origin_country": {
                          "type": "string",
                          "pattern": "^[A-Za-z]{2}$",
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "processing_stage": {
                          "type": "string",
                          "maxLength": 60
                        },
                        "supplier_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$"
                        },
                        "certificate_document_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "A document of this passport"
                        },
                        "component_kind": {
                          "type": "string",
                          "enum": [
                            "product",
                            "packaging"
                          ],
                          "default": "product",
                          "description": "packaging rows are kept out of the composition's 100%"
                        },
                        "disposal_instruction": {
                          "type": "string",
                          "maxLength": 500,
                          "description": "Packaging: how to dispose of the component"
                        },
                        "origin_region": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "producer_group": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "species": {
                          "type": "string",
                          "enum": [
                            "arabica",
                            "robusta"
                          ]
                        }
                      }
                    },
                    "maxItems": 500,
                    "description": "The whole list; an empty one removes every material"
                  }
                },
                "required": [
                  "materials"
                ],
                "additionalProperties": false
              },
              "example": {
                "materials": [
                  {
                    "external_id": "MAT-BODY",
                    "material_name": "Organic cotton jersey",
                    "component_name": "Body",
                    "mass_share_pct": 96,
                    "recycled_content_pct": 0,
                    "origin_country": "IN",
                    "supplier_external_id": "SUP-100"
                  },
                  {
                    "external_id": "MAT-THREAD",
                    "material_name": "Polyester sewing thread",
                    "component_name": "Seams",
                    "mass_share_pct": 4,
                    "recycled_content_pct": 100,
                    "origin_country": "VN"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "materials": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportMaterialWritten"
                      }
                    },
                    "completeness": {
                      "$ref": "#/components/schemas/PassportCompleteness"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "materials",
                    "completeness",
                    "request_id"
                  ]
                },
                "example": {
                  "materials": [
                    {
                      "externalId": "MAT-BODY",
                      "parentExternalId": null,
                      "sortOrder": 0,
                      "componentName": "Body",
                      "materialName": "Full-grain cowhide leather",
                      "materialClass": "leather",
                      "massG": 500,
                      "massSharePct": 80,
                      "recycledContentPct": 0,
                      "renewableContentPct": 100,
                      "hazardous": false,
                      "originCountry": "IT",
                      "processingStage": "dyeing_finishing",
                      "supplierRef": {
                        "externalId": "VEND-000131",
                        "name": "VEND-000131",
                        "countryCode": null
                      },
                      "certificateDocumentExternalId": null,
                      "componentKind": "product",
                      "disposalInstruction": null,
                      "originRegion": null,
                      "producerGroup": null,
                      "species": null
                    }
                  ],
                  "completeness": {
                    "score": 75.86,
                    "sections": [
                      {
                        "section": "materials",
                        "label": "Materials & composition",
                        "score": 81.82,
                        "met": 6,
                        "total": 7,
                        "weight": 22
                      }
                    ],
                    "gaps": [
                      {
                        "id": "impact.carbon_footprint",
                        "label": "Product carbon footprint",
                        "section": "impact",
                        "sectionLabel": "Environmental impact",
                        "severity": "required",
                        "weight": 5,
                        "remediation": "Add the product carbon footprint in kg CO2e.",
                        "regulationRefs": [
                          "ESPR 2024/1781 Annex I"
                        ]
                      }
                    ],
                    "blockingGaps": 0,
                    "requiredGaps": 5,
                    "applicable": 35,
                    "met": 26,
                    "rulesetVersion": "2026.08-textile-v1",
                    "profile": "textile",
                    "regulatoryStatus": "espr_preparation"
                  },
                  "request_id": "7da5de7e-6035-4e55-b845-e366d8174532"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/origin_evidence": {
      "get": {
        "operationId": "listPassportOriginEvidence",
        "summary": "The origin evidence read from a passport's documents, each with its review status",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `evidence`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportOriginEvidence"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportOriginEvidence"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "material_origin_regions": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "description": "ISO 3166-2 subdivision code, for example IT-52"
                      },
                      "description": "Material external id to its confirmed region"
                    },
                    "budget": {
                      "type": "object",
                      "properties": {
                        "allowed": {
                          "type": "boolean"
                        },
                        "remaining": {
                          "type": "integer",
                          "description": "Documents that can still be read for this passport"
                        }
                      },
                      "required": [
                        "allowed",
                        "remaining"
                      ]
                    },
                    "reader_available": {
                      "type": "boolean",
                      "description": "Whether documents can be read for origin right now"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "evidence",
                    "material_origin_regions",
                    "budget",
                    "reader_available",
                    "request_id"
                  ]
                },
                "example": {
                  "evidence": [
                    {
                      "id": "266eac01-057f-44a1-9649-8dccbcce51a3",
                      "document_external_id": "DOC-ORIGIN-04",
                      "document_title": "Tannery declaration of origin 04",
                      "document_kind": "certificate",
                      "status": "confirmed",
                      "extraction": {
                        "ok": true,
                        "extraction": {
                          "plots": [
                            {
                              "page": 2,
                              "label": "Pasture A",
                              "areaHa": 2.8,
                              "country": "IT",
                              "geometry": {
                                "type": "Point",
                                "coordinates": [
                                  11.58,
                                  43.07
                                ]
                              }
                            }
                          ],
                          "issuer": "Conceria Modello S.p.A.",
                          "origins": [
                            {
                              "page": 1,
                              "country": "IT",
                              "material": "Bovine hides",
                              "regionCode": "IT-52",
                              "regionName": "Toscana"
                            }
                          ],
                          "warnings": [
                            "plot_point_without_area"
                          ],
                          "confidence": "high",
                          "custodySteps": [
                            {
                              "uom": "kg",
                              "date": "2026-01-05",
                              "page": 1,
                              "buyer": "Macello Senese S.r.l.",
                              "seller": "Azienda Agricola Val d'Orcia",
                              "quantity": 2400,
                              "regionFrom": null,
                              "countryFrom": null,
                              "documentReference": "DDT-04"
                            }
                          ],
                          "documentType": "tannery_declaration",
                          "documentReference": "TD-2026-04"
                        }
                      },
                      "extracted_at": "2026-11-21T09:39:13.011735+00:00",
                      "suggested": {
                        "country": "IT",
                        "regionCode": "IT-52",
                        "regionName": "Toscana",
                        "ambiguous": false
                      },
                      "confirmed_country": "IT",
                      "confirmed_region_code": "IT-52",
                      "confirmed_region_name": "Toscana",
                      "material_external_ids": [
                        "MAT-BODY"
                      ],
                      "review_note": "Checked against the supplier's declaration",
                      "reviewed_by": "api_key:00000000-0000-4000-8000-000000000001",
                      "reviewed_at": "2026-11-21T09:39:48.253+00:00",
                      "created_at": "2026-11-21T09:39:13.011735+00:00"
                    }
                  ],
                  "material_origin_regions": {
                    "MAT-BODY": "IT-52"
                  },
                  "budget": {
                    "allowed": true,
                    "remaining": 4
                  },
                  "reader_available": false,
                  "request_id": "58246e09-b0c8-453a-848f-33e01d2cfa52",
                  "object": "list",
                  "data": [
                    {
                      "id": "266eac01-057f-44a1-9649-8dccbcce51a3",
                      "document_external_id": "DOC-ORIGIN-04",
                      "document_title": "Tannery declaration of origin 04",
                      "document_kind": "certificate",
                      "status": "confirmed",
                      "extraction": {
                        "ok": true,
                        "extraction": {
                          "plots": [
                            {
                              "page": 2,
                              "label": "Pasture A",
                              "areaHa": 2.8,
                              "country": "IT",
                              "geometry": {
                                "type": "Point",
                                "coordinates": [
                                  11.58,
                                  43.07
                                ]
                              }
                            }
                          ],
                          "issuer": "Conceria Modello S.p.A.",
                          "origins": [
                            {
                              "page": 1,
                              "country": "IT",
                              "material": "Bovine hides",
                              "regionCode": "IT-52",
                              "regionName": "Toscana"
                            }
                          ],
                          "warnings": [
                            "plot_point_without_area"
                          ],
                          "confidence": "high",
                          "custodySteps": [
                            {
                              "uom": "kg",
                              "date": "2026-01-05",
                              "page": 1,
                              "buyer": "Macello Senese S.r.l.",
                              "seller": "Azienda Agricola Val d'Orcia",
                              "quantity": 2400,
                              "regionFrom": null,
                              "countryFrom": null,
                              "documentReference": "DDT-04"
                            }
                          ],
                          "documentType": "tannery_declaration",
                          "documentReference": "TD-2026-04"
                        }
                      },
                      "extracted_at": "2026-11-21T09:39:13.011735+00:00",
                      "suggested": {
                        "country": "IT",
                        "regionCode": "IT-52",
                        "regionName": "Toscana",
                        "ambiguous": false
                      },
                      "confirmed_country": "IT",
                      "confirmed_region_code": "IT-52",
                      "confirmed_region_name": "Toscana",
                      "material_external_ids": [
                        "MAT-BODY"
                      ],
                      "review_note": "Checked against the supplier's declaration",
                      "reviewed_by": "api_key:00000000-0000-4000-8000-000000000001",
                      "reviewed_at": "2026-11-21T09:39:48.253+00:00",
                      "created_at": "2026-11-21T09:39:13.011735+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "evidence"
        }
      },
      "post": {
        "operationId": "createPassportOriginEvidence",
        "summary": "Extract origin evidence from a document of the passport (a PDF or an image, already uploaded): once per document, a repeat returns the stored result; 25 documents per passport",
        "description": "Key scope: ingest. Module: dpp. Reading a document draws on your organization's daily budget for AI-assisted routes (429 model_budget_exceeded past it, with Retry-After). At most 25 documents per passport can be read: past that the answer is 429 with no Retry-After, and the evidence is entered by hand. 415 and 413 are about the stored document, not this request: only PDF and image documents of an evidence kind, up to 10 MB, can be read. 503 extraction_unavailable: reading is switched off for now. 502 extraction_failed: this reading failed and nothing was stored; try again",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "document_external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:@/-]+$",
                    "description": "A document of this passport"
                  }
                },
                "required": [
                  "document_external_id"
                ],
                "additionalProperties": false
              },
              "example": {
                "document_external_id": "DOC-CERT-1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The document was read before: the stored reading, with `cached` true",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              },
              "X-Model-Budget-Limit": {
                "$ref": "#/components/headers/X-Model-Budget-Limit"
              },
              "X-Model-Budget-Remaining": {
                "$ref": "#/components/headers/X-Model-Budget-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "evidence": {
                      "$ref": "#/components/schemas/PassportOriginEvidence"
                    },
                    "cached": {
                      "type": "boolean"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "evidence",
                    "cached",
                    "request_id"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              },
              "X-Model-Budget-Limit": {
                "$ref": "#/components/headers/X-Model-Budget-Limit"
              },
              "X-Model-Budget-Remaining": {
                "$ref": "#/components/headers/X-Model-Budget-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "evidence": {
                      "$ref": "#/components/schemas/PassportOriginEvidence"
                    },
                    "cached": {
                      "type": "boolean"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "evidence",
                    "cached",
                    "request_id"
                  ]
                },
                "example": {
                  "evidence": {
                    "id": "266eac01-057f-44a1-9649-8dccbcce51a3",
                    "document_external_id": "DOC-ORIGIN-04",
                    "document_title": "Tannery declaration of origin 04",
                    "document_kind": "certificate",
                    "status": "pending",
                    "extraction": {
                      "ok": true,
                      "extraction": {
                        "plots": [
                          {
                            "page": 2,
                            "label": "Pasture A",
                            "areaHa": 2.8,
                            "country": "IT",
                            "geometry": {
                              "type": "Point",
                              "coordinates": [
                                11.58,
                                43.07
                              ]
                            }
                          }
                        ],
                        "issuer": "Conceria Modello S.p.A.",
                        "origins": [
                          {
                            "page": 1,
                            "country": "IT",
                            "material": "Bovine hides",
                            "regionCode": "IT-52",
                            "regionName": "Toscana"
                          }
                        ],
                        "warnings": [
                          "plot_point_without_area"
                        ],
                        "confidence": "high",
                        "custodySteps": [
                          {
                            "uom": "kg",
                            "date": "2026-01-05",
                            "page": 1,
                            "buyer": "Macello Senese S.r.l.",
                            "seller": "Azienda Agricola Val d'Orcia",
                            "quantity": 2400,
                            "regionFrom": null,
                            "countryFrom": null,
                            "documentReference": "DDT-04"
                          }
                        ],
                        "documentType": "tannery_declaration",
                        "documentReference": "TD-2026-04"
                      }
                    },
                    "extracted_at": "2026-11-21T09:39:13.011735+00:00",
                    "suggested": {
                      "country": "IT",
                      "regionCode": "IT-52",
                      "regionName": "Toscana",
                      "ambiguous": false
                    },
                    "confirmed_country": null,
                    "confirmed_region_code": null,
                    "confirmed_region_name": null,
                    "material_external_ids": [],
                    "review_note": null,
                    "reviewed_by": null,
                    "reviewed_at": null,
                    "created_at": "2026-11-21T09:39:13.011735+00:00"
                  },
                  "cached": false,
                  "request_id": "0b7e5c1a-3d2f-4a69-8c1e-7f5d2b9a6e10"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/origin_evidence/{evidence_id}/review": {
      "post": {
        "operationId": "reviewPassportOriginEvidence",
        "summary": "Confirm or reject origin evidence; confirm needs country. A decision: the key's creator must still be a member",
        "description": "Key scope: execute. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "evidence_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The id from the passport's origin evidence list"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "confirm",
                      "reject"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "The origin country you confirm (ISO 3166-1 alpha-2). Required when decision is confirm"
                  },
                  "region_code": {
                    "type": "string",
                    "maxLength": 6,
                    "pattern": "^[A-Za-z]{2}-[A-Za-z0-9]{1,3}$",
                    "description": "ISO 3166-2 subdivision of the confirmed country, e.g. IN-GJ"
                  },
                  "region_name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "material_external_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "pattern": "^[A-Za-z0-9_.:@/-]+$"
                    },
                    "maxItems": 50
                  },
                  "plot_commodity": {
                    "type": "string",
                    "enum": [
                      "cattle",
                      "leather",
                      "wood",
                      "rubber",
                      "coffee",
                      "cocoa",
                      "palm_oil",
                      "soy"
                    ],
                    "description": "Required when decision is confirm and the document carries plots"
                  }
                },
                "required": [
                  "decision"
                ],
                "additionalProperties": false
              },
              "example": {
                "decision": "confirm",
                "country": "IN",
                "region_code": "IN-GJ",
                "region_name": "Gujarat",
                "material_external_ids": [
                  "MAT-BODY"
                ],
                "note": "Matches the supplier's declaration"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "evidence": {
                      "$ref": "#/components/schemas/PassportOriginEvidence"
                    },
                    "report": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PassportUflpaReport"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "eudr": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PassportEudrReadiness"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "written": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "transfers": {
                          "type": "integer",
                          "description": "Custody transfers added from the document"
                        },
                        "plots": {
                          "type": "integer",
                          "description": "Plots added from the document"
                        },
                        "skipped_steps": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "step": {
                                "type": "integer",
                                "description": "1-based position in the document's custody steps"
                              },
                              "reason": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "step",
                              "reason"
                            ]
                          }
                        },
                        "skipped_plots": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "plot": {
                                "type": "integer",
                                "description": "1-based position in the document's plots"
                              },
                              "reason": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "plot",
                              "reason"
                            ]
                          }
                        }
                      },
                      "required": [
                        "transfers",
                        "plots",
                        "skipped_steps",
                        "skipped_plots"
                      ],
                      "description": "What a confirmation wrote; report, eudr and written are null after a rejection"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "evidence",
                    "report",
                    "eudr",
                    "written",
                    "request_id"
                  ]
                },
                "example": {
                  "evidence": {
                    "id": "cf8b2ad5-f389-4a81-9f65-960fdebb5651",
                    "document_external_id": "DOC-ORIGIN-03",
                    "document_title": "Tannery declaration of origin 03",
                    "document_kind": "certificate",
                    "status": "confirmed",
                    "extraction": {
                      "ok": true,
                      "extraction": {
                        "plots": [
                          {
                            "page": 2,
                            "label": "Pasture A",
                            "areaHa": 2.8,
                            "country": "IT",
                            "geometry": {
                              "type": "Point",
                              "coordinates": [
                                11.58,
                                43.07
                              ]
                            }
                          }
                        ],
                        "issuer": "Conceria Modello S.p.A.",
                        "origins": [
                          {
                            "page": 1,
                            "country": "IT",
                            "material": "Bovine hides",
                            "regionCode": "IT-52",
                            "regionName": "Toscana"
                          }
                        ],
                        "warnings": [
                          "plot_point_without_area"
                        ],
                        "confidence": "high",
                        "custodySteps": [
                          {
                            "uom": "kg",
                            "date": "2026-01-04",
                            "page": 1,
                            "buyer": "Macello Senese S.r.l.",
                            "seller": "Azienda Agricola Val d'Orcia",
                            "quantity": 2400,
                            "regionFrom": null,
                            "countryFrom": null,
                            "documentReference": "DDT-03"
                          }
                        ],
                        "documentType": "tannery_declaration",
                        "documentReference": "TD-2026-03"
                      }
                    },
                    "extracted_at": "2026-11-21T09:39:13.011735+00:00",
                    "suggested": {
                      "country": "IT",
                      "regionCode": "IT-52",
                      "regionName": "Toscana",
                      "ambiguous": false
                    },
                    "confirmed_country": "IT",
                    "confirmed_region_code": "IT-52",
                    "confirmed_region_name": "Toscana",
                    "material_external_ids": [
                      "MAT-BODY"
                    ],
                    "review_note": "Checked against the supplier's declaration",
                    "reviewed_by": "api_key:00000000-0000-4000-8000-000000000001",
                    "reviewed_at": "2026-11-21T10:55:55.561+00:00",
                    "created_at": "2026-11-21T09:39:13.011735+00:00"
                  },
                  "report": {
                    "rulesetVersion": "2026.08-uflpa-v1",
                    "regionsVersion": "2026.08-uflpa-regions-v1",
                    "effectiveDate": "2026-08-20",
                    "basis": "Based on the UFLPA (Pub. L. 117-78) rebuttable presumption and CBP's Operational Guidance for Importers (June 2022) on admissibility pack...",
                    "asOf": "2026-11-21",
                    "verdict": "gaps_found",
                    "checks": [
                      {
                        "id": "custody.chain_present",
                        "label": "Chain of custody recorded",
                        "status": "pass",
                        "detail": null,
                        "remediation": null,
                        "regulationRefs": [
                          "UFLPA §3"
                        ]
                      }
                    ],
                    "counts": {
                      "pass": 6,
                      "fail": 3,
                      "manualReview": 0,
                      "notApplicable": 0
                    }
                  },
                  "eudr": {
                    "inScope": true,
                    "ready": true,
                    "gaps": [],
                    "plotCount": 18,
                    "coveredMaterials": [
                      "MAT-BODY"
                    ],
                    "uncoveredMaterials": [],
                    "commodities": [
                      "leather"
                    ],
                    "lotPlotCount": 0,
                    "euMarket": false,
                    "ddsReferenceCount": 0,
                    "plotsWithoutAttestation": 18
                  },
                  "written": {
                    "transfers": 2,
                    "plots": 1,
                    "skipped_steps": [
                      {
                        "step": 3,
                        "reason": "no_date"
                      }
                    ],
                    "skipped_plots": [
                      {
                        "plot": 2,
                        "reason": "point_requires_area"
                      }
                    ]
                  },
                  "request_id": "2d3650d5-2c4e-4be7-8d7d-3c3b2468e8c9"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/publish": {
      "post": {
        "operationId": "publishPassport",
        "summary": "Publish a version (422 while blocking gaps remain). Publishing does not open the passport to the public: public_enabled does. A decision: the key's creator must still be a member",
        "description": "Key scope: execute. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "change_note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "change_note": "Bill of materials completed"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "passport": {
                      "$ref": "#/components/schemas/Passport"
                    },
                    "version": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer"
                        },
                        "checksum": {
                          "type": "string",
                          "description": "SHA-256 of the published content, hex"
                        },
                        "published_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "version",
                        "checksum",
                        "published_at"
                      ]
                    },
                    "completeness": {
                      "$ref": "#/components/schemas/PassportCompleteness"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "passport",
                    "version",
                    "completeness",
                    "request_id"
                  ]
                },
                "example": {
                  "passport": {
                    "id": "5f042be4-0cce-4a7f-ab93-bbcb8c35ef81",
                    "org_id": "4fc7a944-6245-4491-b6af-694bd6bd14cf",
                    "external_id": "TOTE-MAT-00000023",
                    "granularity": "model",
                    "item_id": "221641ba-5901-43de-bacd-998771b3a578",
                    "variant_id": null,
                    "lot_id": null,
                    "tracked_unit_id": null,
                    "item_external_id": "MAT-00000023",
                    "lot_external_id": null,
                    "gtin": "00012345678905",
                    "batch_lot": null,
                    "serial": null,
                    "title": {
                      "en": "Canvas tote",
                      "fr": "Cabas en toile"
                    },
                    "brand": "Northwind Atelier",
                    "category": "Handbags",
                    "status": "published",
                    "published_version_id": "7cf4ec15-e6ae-4a3c-83b3-3e03f87cf808",
                    "draft_data": {
                      "impact": {
                        "water_m3": 0.4,
                        "energy_kwh": 3.2
                      },
                      "durability": [
                        {
                          "value": "Grade 5",
                          "metric": "abrasion",
                          "standard_ref": "ISO 12947-2"
                        }
                      ],
                      "image_urls": [
                        "images/canvas-tote-front.jpg"
                      ],
                      "circularity": {
                        "takeback_url": "https://example.com/takeback",
                        "material_routes": [
                          {
                            "route": "metal_recycling",
                            "material": "Brass"
                          }
                        ],
                        "recyclability_route": {
                          "en": "Leather is repurposable; hardware is recyclable."
                        },
                        "takeback_scheme_name": "Take-back",
                        "epr_registration_number": "IT-EPR-0001"
                      },
                      "manufacturing": {
                        "assembly_country": "IT",
                        "facility_country": "IT",
                        "facility_external_id": "FAC-IT-0001"
                      },
                      "repairability": {
                        "score": 8,
                        "summary": {
                          "en": "Straps and hardware are replaceable."
                        },
                        "spare_parts_url": "https://example.com/spares",
                        "disassembly_steps": [
                          "Unclip the strap."
                        ],
                        "disassembly_tools": [
                          "Screwdriver"
                        ]
                      },
                      "stage_origins": [
                        {
                          "stage": "fibre",
                          "country_code": "IT"
                        }
                      ],
                      "care_instructions": {
                        "en": "Wipe with a soft, dry cloth."
                      }
                    },
                    "completeness_score": 81.11,
                    "compliance_state": "incomplete",
                    "ruleset_version": "2026.08-textile-v1",
                    "public_enabled": false,
                    "registry_ref": null,
                    "created_at": "2026-11-21T10:55:55.212128+00:00",
                    "updated_at": "2026-11-21T10:55:55.614206+00:00",
                    "profile": "textile",
                    "model_passport_id": null,
                    "eu_market": false
                  },
                  "version": {
                    "id": "7cf4ec15-e6ae-4a3c-83b3-3e03f87cf808",
                    "version": 1,
                    "checksum": "981927c85ea8834e2ead3309678b336ca7d7407a45cfe7616c71be6db4a1de8f",
                    "published_at": "2026-11-21T10:55:55.609+00:00"
                  },
                  "completeness": {
                    "score": 81.11,
                    "sections": [
                      {
                        "section": "materials",
                        "label": "Materials & composition",
                        "score": 81.82,
                        "met": 6,
                        "total": 7,
                        "weight": 22
                      }
                    ],
                    "gaps": [
                      {
                        "id": "impact.carbon_footprint",
                        "label": "Product carbon footprint",
                        "section": "impact",
                        "sectionLabel": "Environmental impact",
                        "severity": "required",
                        "weight": 5,
                        "remediation": "Add the product carbon footprint in kg CO2e.",
                        "regulationRefs": [
                          "ESPR 2024/1781 Annex I"
                        ]
                      }
                    ],
                    "blockingGaps": 0,
                    "requiredGaps": 4,
                    "applicable": 36,
                    "met": 29,
                    "rulesetVersion": "2026.08-textile-v1",
                    "profile": "textile",
                    "regulatoryStatus": "espr_preparation"
                  },
                  "request_id": "2f15db65-1845-47b3-8248-da5971820d26"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/substances": {
      "get": {
        "operationId": "listPassportSubstances",
        "summary": "A passport's substance declarations",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `substances`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportSubstance"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "substances": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportSubstance"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "substances",
                    "request_id"
                  ]
                },
                "example": {
                  "substances": [
                    {
                      "externalId": "SUB-CR6",
                      "materialExternalId": "MAT-BODY",
                      "substanceName": "Chromium VI",
                      "casNumber": "18540-29-9",
                      "ecNumber": "242-403-9",
                      "regulation": "REACH_ANNEX_XVII",
                      "concentrationPpm": 0,
                      "aboveThreshold": false,
                      "scipRef": null,
                      "safeUseInstructions": "Chrome-free vegetable tannage; Cr(VI) not detected at a 3 mg/kg limit of quantification."
                    }
                  ],
                  "request_id": "3ba18fb5-8bf9-468f-8dd2-b06d9a108f62",
                  "object": "list",
                  "data": [
                    {
                      "externalId": "SUB-CR6",
                      "materialExternalId": "MAT-BODY",
                      "substanceName": "Chromium VI",
                      "casNumber": "18540-29-9",
                      "ecNumber": "242-403-9",
                      "regulation": "REACH_ANNEX_XVII",
                      "concentrationPpm": 0,
                      "aboveThreshold": false,
                      "scipRef": null,
                      "safeUseInstructions": "Chrome-free vegetable tannage; Cr(VI) not detected at a 3 mg/kg limit of quantification."
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "substances"
        }
      },
      "put": {
        "operationId": "replacePassportSubstances",
        "summary": "Replace substance declarations",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "substances": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "external_id",
                        "substance_name"
                      ],
                      "properties": {
                        "external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$",
                          "description": "Your id for the declaration, unique in the list"
                        },
                        "substance_name": {
                          "type": "string",
                          "maxLength": 300
                        },
                        "regulation": {
                          "type": "string",
                          "enum": [
                            "REACH_SVHC",
                            "REACH_ANNEX_XVII",
                            "POP",
                            "CLP"
                          ],
                          "default": "REACH_SVHC"
                        },
                        "material_external_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[A-Za-z0-9_.:@/-]+$"
                        },
                        "cas_number": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "ec_number": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "concentration_ppm": {
                          "type": "number",
                          "minimum": 0
                        },
                        "above_threshold": {
                          "type": "boolean",
                          "default": false
                        },
                        "scip_ref": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "safe_use_instructions": {
                          "type": "string",
                          "maxLength": 2000
                        }
                      }
                    },
                    "maxItems": 1000,
                    "description": "The whole list; an empty one removes every declaration"
                  }
                },
                "required": [
                  "substances"
                ],
                "additionalProperties": false
              },
              "example": {
                "substances": [
                  {
                    "external_id": "SUB-1",
                    "substance_name": "Disperse dye, declared below threshold",
                    "regulation": "REACH_SVHC",
                    "material_external_id": "MAT-THREAD",
                    "concentration_ppm": 120,
                    "above_threshold": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "substances": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportSubstance"
                      }
                    },
                    "completeness": {
                      "$ref": "#/components/schemas/PassportCompleteness"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "substances",
                    "completeness",
                    "request_id"
                  ]
                },
                "example": {
                  "substances": [
                    {
                      "externalId": "SUB-CR6",
                      "materialExternalId": "MAT-BODY",
                      "substanceName": "Chromium VI",
                      "casNumber": "18540-29-9",
                      "ecNumber": "242-403-9",
                      "regulation": "REACH_ANNEX_XVII",
                      "concentrationPpm": 0,
                      "aboveThreshold": false,
                      "scipRef": null,
                      "safeUseInstructions": "Not detected at a 3 mg/kg limit of quantification."
                    }
                  ],
                  "completeness": {
                    "score": 76.67,
                    "sections": [
                      {
                        "section": "materials",
                        "label": "Materials & composition",
                        "score": 81.82,
                        "met": 6,
                        "total": 7,
                        "weight": 22
                      }
                    ],
                    "gaps": [
                      {
                        "id": "impact.carbon_footprint",
                        "label": "Product carbon footprint",
                        "section": "impact",
                        "sectionLabel": "Environmental impact",
                        "severity": "required",
                        "weight": 5,
                        "remediation": "Add the product carbon footprint in kg CO2e.",
                        "regulationRefs": [
                          "ESPR 2024/1781 Annex I"
                        ]
                      }
                    ],
                    "blockingGaps": 0,
                    "requiredGaps": 5,
                    "applicable": 36,
                    "met": 27,
                    "rulesetVersion": "2026.08-textile-v1",
                    "profile": "textile",
                    "regulatoryStatus": "espr_preparation"
                  },
                  "request_id": "a3412611-402f-445d-a334-76948399e624"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/uflpa": {
      "get": {
        "operationId": "getPassportUflpa",
        "summary": "A passport's UFLPA review and the evidence packages assembled so far",
        "description": "Key scope: read (or execute). Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "report": {
                      "$ref": "#/components/schemas/PassportUflpaReport"
                    },
                    "packages": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportUflpaPackage"
                      },
                      "description": "The evidence packages assembled so far, newest first"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "report",
                    "packages",
                    "request_id"
                  ]
                },
                "example": {
                  "report": {
                    "rulesetVersion": "2026.08-uflpa-v1",
                    "regionsVersion": "2026.08-uflpa-regions-v1",
                    "effectiveDate": "2026-08-20",
                    "basis": "Based on the UFLPA (Pub. L. 117-78) rebuttable presumption and CBP's Operational Guidance for Importers (June 2022) on admissibility pack...",
                    "asOf": "2026-11-21",
                    "verdict": "gaps_found",
                    "checks": [
                      {
                        "id": "custody.chain_present",
                        "label": "Chain of custody recorded",
                        "status": "pass",
                        "detail": null,
                        "remediation": null,
                        "regulationRefs": [
                          "UFLPA §3"
                        ]
                      }
                    ],
                    "counts": {
                      "pass": 6,
                      "fail": 3,
                      "manualReview": 0,
                      "notApplicable": 0
                    }
                  },
                  "packages": [
                    {
                      "id": "abc2d187-c560-4b12-a3b4-56b04b6d6eb0",
                      "external_ref": "UFLPA-001",
                      "checksum": "6bbcb439ba22bf008509afe63a707540addeb580004e4d138aa144d251527983",
                      "verdict": "gaps_found",
                      "note": "Prepared ahead of the spring shipment",
                      "generated_at": "2026-11-21T09:38:53.69+00:00",
                      "created_at": "2026-11-21T09:38:53.694729+00:00",
                      "package": {
                        "eudr": {
                          "ready": true,
                          "inScope": true,
                          "plotCount": 2,
                          "coveredMaterials": [
                            "MAT-BODY"
                          ],
                          "uncoveredMaterials": []
                        },
                        "drill": {
                          "asOf": "2026-11-21",
                          "basis": "Based on the UFLPA (Pub. L. 117-78) rebuttable presumption and CBP's Operational Guidance for Importers (June 2022) on admissibility pack...",
                          "checks": [
                            {
                              "id": "custody.chain_present",
                              "label": "Chain of custody recorded",
                              "detail": null,
                              "status": "pass",
                              "remediation": null,
                              "regulationRefs": [
                                "UFLPA §3"
                              ]
                            }
                          ],
                          "counts": {
                            "fail": 3,
                            "pass": 6,
                            "manualReview": 0,
                            "notApplicable": 0
                          },
                          "verdict": "gaps_found",
                          "effectiveDate": "2026-08-20",
                          "regionsVersion": "2026.08-uflpa-regions-v1",
                          "rulesetVersion": "2026.08-uflpa-v1"
                        },
                        "schema": "dpp.uflpa.package.v1",
                        "product": {
                          "gtin": "00400000000121",
                          "brand": "Northwind",
                          "title": {
                            "en": "Harbor Shoulder Bag 26",
                            "fr": "Sac porté épaule Harbor 26"
                          },
                          "serial": "NW-26-0000001",
                          "batchLot": "LOT-2026-0212",
                          "category": "Handbags",
                          "externalId": "NORTHWIND-HARBOR26-NH2601",
                          "granularity": "item"
                        },
                        "generatedAt": "2026-11-21T09:38:53.690Z",
                        "custodyChain": [
                          {
                            "uom": "kg",
                            "toParty": "Conceria Modello S.p.A.",
                            "evidence": [
                              {
                                "evidenceKind": "invoice",
                                "documentExternalId": "DOC-INV-88412"
                              }
                            ],
                            "quantity": 1800,
                            "fromParty": "Azienda Agricola Val d'Orcia",
                            "externalId": "XFER-HIDES",
                            "fromRegion": null,
                            "fromCountry": "IT",
                            "transferDate": "2026-02-03",
                            "materialExternalId": "MAT-BODY",
                            "supplierExternalId": null
                          }
                        ],
                        "regionsVersion": "2026.08-uflpa-regions-v1",
                        "rulesetVersion": "2026.08-uflpa-v1",
                        "billOfMaterials": [
                          {
                            "supplier": null,
                            "externalId": "MAT-BODY",
                            "provenance": "brand_declared",
                            "massSharePct": 82,
                            "materialName": "Full-grain cowhide leather",
                            "originRegion": null,
                            "componentName": "Body",
                            "materialClass": "leather",
                            "originCountry": "IT",
                            "certificateRef": null,
                            "parentExternalId": null
                          }
                        ],
                        "referencedDocuments": [
                          {
                            "kind": "other",
                            "title": "Bill of lading 5521",
                            "issuer": null,
                            "validFrom": null,
                            "externalId": "DOC-BOL-5521",
                            "validUntil": null,
                            "standardRef": null
                          }
                        ],
                        "supplierAttestations": {
                          "suppliers": [],
                          "byProvenance": {
                            "certificate": 0,
                            "brand_declared": 3,
                            "supplier_attested": 0
                          },
                          "inScopeMaterials": 3
                        }
                      }
                    }
                  ],
                  "request_id": "7b6257d7-c0e9-48fe-b5c6-10a9d8f3b3ac"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false
      }
    },
    "/v1/passports/{id}/uflpa/package": {
      "post": {
        "operationId": "createPassportUflpaPackage",
        "summary": "Assemble a UFLPA evidence package",
        "description": "Key scope: ingest. Module: dpp.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "note": "Prepared for the December shipment"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "package": {
                      "$ref": "#/components/schemas/PassportUflpaPackage"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "package",
                    "request_id"
                  ]
                },
                "example": {
                  "package": {
                    "id": "39d73102-320f-4f8f-aa5a-abe38b59b78b",
                    "external_ref": "UFLPA-001",
                    "checksum": "5ca626876244569d1263af559a64352d9afdea886813ea512a05f31d9c94c1bf",
                    "verdict": "gaps_found",
                    "note": "Prepared for the customs broker",
                    "generated_at": "2026-11-21T10:55:55.5+00:00",
                    "created_at": "2026-11-21T10:55:55.503407+00:00",
                    "package": {
                      "eudr": {
                        "ready": true,
                        "inScope": true,
                        "plotCount": 2,
                        "coveredMaterials": [
                          "MAT-BODY"
                        ],
                        "uncoveredMaterials": []
                      },
                      "drill": {
                        "asOf": "2026-11-21",
                        "basis": "Based on the UFLPA (Pub. L. 117-78) rebuttable presumption and CBP's Operational Guidance for Importers (June 2022) on admissibility pack...",
                        "checks": [
                          {
                            "id": "custody.chain_present",
                            "label": "Chain of custody recorded",
                            "detail": null,
                            "status": "pass",
                            "remediation": null,
                            "regulationRefs": [
                              "UFLPA §3"
                            ]
                          }
                        ],
                        "counts": {
                          "fail": 3,
                          "pass": 6,
                          "manualReview": 0,
                          "notApplicable": 0
                        },
                        "verdict": "gaps_found",
                        "effectiveDate": "2026-08-20",
                        "regionsVersion": "2026.08-uflpa-regions-v1",
                        "rulesetVersion": "2026.08-uflpa-v1"
                      },
                      "schema": "dpp.uflpa.package.v1",
                      "product": {
                        "gtin": "00012345678905",
                        "brand": "Northwind Atelier",
                        "title": {
                          "en": "Canvas tote",
                          "fr": "Cabas en toile"
                        },
                        "serial": null,
                        "batchLot": null,
                        "category": "Handbags",
                        "externalId": "TOTE-MAT-00000023",
                        "granularity": "model"
                      },
                      "generatedAt": "2026-11-21T10:55:55.500Z",
                      "custodyChain": [
                        {
                          "uom": "kg",
                          "toParty": "Conceria Esempio S.p.A.",
                          "evidence": [
                            {
                              "evidenceKind": "certificate",
                              "documentExternalId": "DOC-TANNERY-DECLARATION"
                            }
                          ],
                          "quantity": 1200,
                          "fromParty": "Azienda Agricola Esempio",
                          "externalId": "XFER-1",
                          "fromRegion": null,
                          "fromCountry": "IT",
                          "transferDate": "2026-01-12",
                          "materialExternalId": "MAT-BODY",
                          "supplierExternalId": null
                        }
                      ],
                      "regionsVersion": "2026.08-uflpa-regions-v1",
                      "rulesetVersion": "2026.08-uflpa-v1",
                      "billOfMaterials": [
                        {
                          "supplier": {
                            "name": "Guangzhou Footwear Mfg 0131",
                            "externalId": "VEND-000131",
                            "countryCode": "MX"
                          },
                          "externalId": "MAT-BODY",
                          "provenance": "brand_declared",
                          "massSharePct": 80,
                          "materialName": "Full-grain cowhide leather",
                          "originRegion": null,
                          "componentName": "Body",
                          "materialClass": "leather",
                          "originCountry": "IT",
                          "certificateRef": null,
                          "parentExternalId": null
                        }
                      ],
                      "referencedDocuments": [
                        {
                          "kind": "certificate",
                          "title": "Tannery declaration of origin",
                          "issuer": "Conceria Esempio S.p.A.",
                          "validFrom": "2026-01-01",
                          "externalId": "DOC-TANNERY-DECLARATION",
                          "validUntil": "2028-12-31",
                          "standardRef": "LWG Gold"
                        }
                      ],
                      "supplierAttestations": {
                        "suppliers": [
                          {
                            "name": "Guangzhou Footwear Mfg 0131",
                            "externalId": "VEND-000131",
                            "countryCode": "MX"
                          }
                        ],
                        "byProvenance": {
                          "certificate": 0,
                          "brand_declared": 2,
                          "supplier_attested": 0
                        },
                        "inScopeMaterials": 2
                      }
                    }
                  },
                  "request_id": "71e19d00-ef55-473d-91e2-7780591e2eae"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "ingest",
        "x-module": "dpp",
        "x-writes": true
      }
    },
    "/v1/passports/{id}/versions": {
      "get": {
        "operationId": "listPassportVersions",
        "summary": "A passport's published versions, newest first",
        "description": "Key scope: read (or execute). Module: dpp. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `versions`, deprecated.",
        "tags": [
          "passports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "string",
                  "pattern": "^ext:.{1,256}$"
                }
              ]
            },
            "description": "The record's id (a UUID), or `ext:<external_id>` with your own id for it, URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportVersion"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "versions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassportVersion"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "published_version_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid",
                      "description": "The version of record"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "versions",
                    "published_version_id",
                    "request_id"
                  ]
                },
                "example": {
                  "versions": [
                    {
                      "id": "a866f7a4-0b87-49e4-b531-d1c9c2f01e75",
                      "version": 1,
                      "checksum": "1543dbbbeab168231bdafafeb3b934d0212c822d0bf3502a0d26a3928395e940",
                      "completeness_score": 85.57,
                      "ruleset_version": "2026.08-textile-v1",
                      "change_note": "First published version",
                      "published_at": "2026-11-21T09:18:15.273+00:00"
                    }
                  ],
                  "published_version_id": "a866f7a4-0b87-49e4-b531-d1c9c2f01e75",
                  "request_id": "60d61e4e-afc7-4770-8eb8-949c77964ecc",
                  "object": "list",
                  "data": [
                    {
                      "id": "a866f7a4-0b87-49e4-b531-d1c9c2f01e75",
                      "version": 1,
                      "checksum": "1543dbbbeab168231bdafafeb3b934d0212c822d0bf3502a0d26a3928395e940",
                      "completeness_score": 85.57,
                      "ruleset_version": "2026.08-textile-v1",
                      "change_note": "First published version",
                      "published_at": "2026-11-21T09:18:15.273+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "dpp",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "versions"
        }
      }
    },
    "/v1/recalls/matches": {
      "get": {
        "operationId": "listRecallMatches",
        "summary": "Product recall notices matched to your items, newest first, each with the basis of the match, a score, and whether a person confirmed or dismissed it",
        "description": "Key scope: read (or execute). Module: product_compliance. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `matches`, deprecated.",
        "tags": [
          "recalls"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "candidate",
                "confirmed",
                "dismissed"
              ]
            }
          },
          {
            "name": "basis",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "gtin",
                "brand_model",
                "text"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RecallMatchListItem"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "matches": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RecallMatchListItem"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "matches",
                    "next_offset",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "2a89d076-68ee-40e1-9444-99003c575663",
                  "matches": [
                    {
                      "id": "f22ad17b-0060-4243-9b75-c817931ca35b",
                      "notice_id": "000e33bf-7ff2-4bad-95f0-160fd8dc1e3a",
                      "item_id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                      "basis": "gtin",
                      "score": 1,
                      "confirm_ready": true,
                      "status": "confirmed",
                      "evidence": {
                        "gtins": [
                          "07394311921349"
                        ]
                      },
                      "decided_by": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                      "decided_at": "2026-11-21T10:55:05.858+00:00",
                      "decision_note": "The barcode on our item is the one in the notice",
                      "follow_up_done_at": "2026-11-21T10:55:05.869+00:00",
                      "follow_up": {
                        "alert": "already_raised",
                        "done_at": "2026-11-21T10:55:05.869Z",
                        "match_id": "f22ad17b-0060-4243-9b75-c817931ca35b",
                        "holds_existing": 3,
                        "holds_proposed": 0,
                        "webhooks_pending": 0,
                        "exposure_truncated": false,
                        "holds_notice_added": 0,
                        "webhooks_delivered": 0,
                        "locations_with_stock": 3
                      },
                      "created_at": "2026-11-21T09:36:48.680797+00:00",
                      "updated_at": "2026-11-21T10:55:05.872588+00:00",
                      "notice": {
                        "id": "000e33bf-7ff2-4bad-95f0-160fd8dc1e3a",
                        "source": "eu_consumer_products",
                        "source_id": "SR/00001/26",
                        "notice_type": "alert",
                        "title": "Modelling foam; Example Toys",
                        "published_on": "2026-11-18",
                        "jurisdiction": "EU",
                        "product_name": "Modelling foam",
                        "brand": "Example Toys",
                        "url": "https://www.example.com/safety-alerts/10000001",
                        "authority": "EU Safety Gate"
                      },
                      "item": {
                        "id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                        "external_id": "MAT-00000001",
                        "description": "Small Leather Goods - Style 00000001"
                      }
                    }
                  ],
                  "has_more": false,
                  "next_offset": null,
                  "object": "list",
                  "data": [
                    {
                      "id": "f22ad17b-0060-4243-9b75-c817931ca35b",
                      "notice_id": "000e33bf-7ff2-4bad-95f0-160fd8dc1e3a",
                      "item_id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                      "basis": "gtin",
                      "score": 1,
                      "confirm_ready": true,
                      "status": "confirmed",
                      "evidence": {
                        "gtins": [
                          "07394311921349"
                        ]
                      },
                      "decided_by": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                      "decided_at": "2026-11-21T10:55:05.858+00:00",
                      "decision_note": "The barcode on our item is the one in the notice",
                      "follow_up_done_at": "2026-11-21T10:55:05.869+00:00",
                      "follow_up": {
                        "alert": "already_raised",
                        "done_at": "2026-11-21T10:55:05.869Z",
                        "match_id": "f22ad17b-0060-4243-9b75-c817931ca35b",
                        "holds_existing": 3,
                        "holds_proposed": 0,
                        "webhooks_pending": 0,
                        "exposure_truncated": false,
                        "holds_notice_added": 0,
                        "webhooks_delivered": 0,
                        "locations_with_stock": 3
                      },
                      "created_at": "2026-11-21T09:36:48.680797+00:00",
                      "updated_at": "2026-11-21T10:55:05.872588+00:00",
                      "notice": {
                        "id": "000e33bf-7ff2-4bad-95f0-160fd8dc1e3a",
                        "source": "eu_consumer_products",
                        "source_id": "SR/00001/26",
                        "notice_type": "alert",
                        "title": "Modelling foam; Example Toys",
                        "published_on": "2026-11-18",
                        "jurisdiction": "EU",
                        "product_name": "Modelling foam",
                        "brand": "Example Toys",
                        "url": "https://www.example.com/safety-alerts/10000001",
                        "authority": "EU Safety Gate"
                      },
                      "item": {
                        "id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                        "external_id": "MAT-00000001",
                        "description": "Small Leather Goods - Style 00000001"
                      }
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "product_compliance",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "matches"
        }
      }
    },
    "/v1/recalls/matches/{id}": {
      "get": {
        "operationId": "getRecallMatch",
        "summary": "One recall match with its notice (issuing authority and a link to the official notice), why it matched (each identifier compared, the notice's value beside your item's), and where the item is: stock on hand and in transit by location and lot, open purchase orders, inbound ship notices, and the hold tasks proposed for it",
        "description": "Key scope: read (or execute). Module: product_compliance. exposure reads at most 2,000 inventory rows, 500 purchase-order lines and 200 ship notices (`exposure.truncated` says which were cut); at most 200 hold tasks, `hold_tasks_truncated` is true when more exist; `match_reasons` lists at most 10 GTINs and 10 model numbers",
        "tags": [
          "recalls"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "match": {
                      "$ref": "#/components/schemas/RecallMatch"
                    },
                    "notice": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/RecallNoticeDetail"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "item": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "external_id",
                        "description"
                      ]
                    },
                    "match_reasons": {
                      "type": "object",
                      "properties": {
                        "basis": {
                          "type": "string",
                          "enum": [
                            "gtin",
                            "brand_model",
                            "text"
                          ]
                        },
                        "reasons": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "identifier": {
                                "type": "string",
                                "enum": [
                                  "gtin",
                                  "brand",
                                  "model",
                                  "product_name"
                                ]
                              },
                              "notice_value": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "The notice's value as published"
                              },
                              "item_value": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Your item's value as recorded"
                              },
                              "agrees": {
                                "type": [
                                  "boolean",
                                  "null"
                                ],
                                "description": "true: the same once normalized; false: both known and different; null: not compared as equal or unequal (a name, or a value missing on a side)"
                              }
                            },
                            "required": [
                              "identifier",
                              "notice_value",
                              "item_value",
                              "agrees"
                            ]
                          }
                        },
                        "shared_words": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Name matches: the notice's name words found on the item"
                        },
                        "notice_words": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Name matches: the notice's name words compared"
                        },
                        "restricted_circulation": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "basis",
                        "reasons",
                        "shared_words",
                        "notice_words",
                        "restricted_circulation"
                      ],
                      "description": "Each identifier compared: the notice's value beside your item's"
                    },
                    "exposure": {
                      "$ref": "#/components/schemas/RecallExposure"
                    },
                    "lot_exposure": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/RecallLotExposure",
                          "description": "When the notice names lot codes or dates: your lots it names, the lots made from them, their stock and who received them; null when it names none"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "hold_tasks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RecallHoldTask"
                      },
                      "description": "The hold tasks covering this match, oldest first"
                    },
                    "hold_tasks_truncated": {
                      "type": "boolean"
                    },
                    "second_opinion": {
                      "type": "object",
                      "properties": {
                        "offered": {
                          "type": "boolean",
                          "description": "Whether a second opinion can be asked for this match"
                        },
                        "not_offered": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "match_decided",
                            "gtin_match",
                            "not_offered",
                            null
                          ],
                          "description": "Why not; null when offered"
                        },
                        "configured": {
                          "type": "boolean",
                          "description": "Whether second opinions are available right now"
                        },
                        "cap": {
                          "type": "object",
                          "properties": {
                            "limit": {
                              "type": "integer"
                            },
                            "used_today": {
                              "type": "integer"
                            },
                            "remaining": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "limit",
                            "used_today",
                            "remaining"
                          ],
                          "description": "Your organization's daily allowance of second opinions (UTC day)"
                        },
                        "opinion": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/RecallOpinion",
                              "description": "The stored opinion, newest for the current values first; null when none was asked"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "offered",
                        "not_offered",
                        "configured",
                        "cap",
                        "opinion"
                      ]
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "match",
                    "notice",
                    "item",
                    "match_reasons",
                    "exposure",
                    "hold_tasks",
                    "hold_tasks_truncated",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "615c5810-3c75-43d3-9e36-45abad04ee83",
                  "match": {
                    "id": "f22ad17b-0060-4243-9b75-c817931ca35b",
                    "notice_id": "000e33bf-7ff2-4bad-95f0-160fd8dc1e3a",
                    "item_id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                    "basis": "gtin",
                    "score": 1,
                    "confirm_ready": true,
                    "status": "confirmed",
                    "evidence": {
                      "gtins": [
                        "07394311921349"
                      ]
                    },
                    "decided_by": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                    "decided_at": "2026-11-21T10:55:05.858+00:00",
                    "decision_note": "The barcode on our item is the one in the notice",
                    "follow_up_done_at": "2026-11-21T10:55:05.869+00:00",
                    "follow_up": {
                      "alert": "already_raised",
                      "done_at": "2026-11-21T10:55:05.869Z",
                      "match_id": "f22ad17b-0060-4243-9b75-c817931ca35b",
                      "holds_existing": 3,
                      "holds_proposed": 0,
                      "webhooks_pending": 0,
                      "exposure_truncated": false,
                      "holds_notice_added": 0,
                      "webhooks_delivered": 0,
                      "locations_with_stock": 3
                    },
                    "created_at": "2026-11-21T09:36:48.680797+00:00",
                    "updated_at": "2026-11-21T10:55:05.872588+00:00"
                  },
                  "notice": {
                    "id": "000e33bf-7ff2-4bad-95f0-160fd8dc1e3a",
                    "source": "eu_consumer_products",
                    "source_id": "SR/00001/26",
                    "notice_type": "alert",
                    "title": "Modelling foam; Example Toys",
                    "published_on": "2026-11-18",
                    "jurisdiction": "EU",
                    "product_name": "Modelling foam",
                    "brand": "Example Toys",
                    "url": "https://www.example.com/safety-alerts/10000001",
                    "source_updated_on": null,
                    "model_numbers": [
                      "2471666"
                    ],
                    "gtins": [
                      "07394311921349"
                    ],
                    "category": "Toys",
                    "hazard": "Chemical: The migration of boron from the clay is too high (measured value: 1395 mg/kg). Ingestion or contact with an excessive quantity ...",
                    "remedy": "Type of economic operator taking notified measure(s): ManufacturerCategory of measure(s): Withdrawal of the product from the marketDate o...",
                    "first_seen_at": "2026-11-21T09:20:15.081334+00:00",
                    "last_seen_at": "2026-11-21T09:20:12.339+00:00",
                    "authority": "EU Safety Gate",
                    "code_info": null,
                    "lot_codes": [],
                    "code_dates": [],
                    "all_lots": false,
                    "firm": null
                  },
                  "item": {
                    "id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                    "external_id": "MAT-00000001",
                    "description": "Small Leather Goods - Style 00000001"
                  },
                  "match_reasons": {
                    "basis": "gtin",
                    "reasons": [
                      {
                        "identifier": "gtin",
                        "notice_value": "07394311921349",
                        "item_value": null,
                        "agrees": null
                      }
                    ],
                    "shared_words": null,
                    "notice_words": null,
                    "restricted_circulation": false
                  },
                  "exposure": {
                    "item": {
                      "id": "f29f7ba4-eb59-4852-85ec-3bf82a4678d4",
                      "external_id": "MAT-00000001",
                      "description": "Small Leather Goods - Style 00000001"
                    },
                    "totals": {
                      "on_hand": 8,
                      "in_transit": 0,
                      "locations_with_stock": 3,
                      "open_purchase_quantity": 286,
                      "inbound_ship_notice_quantity": 0
                    },
                    "locations": [
                      {
                        "location_id": "6acfc06a-aea7-423c-9053-9e76080fa180",
                        "external_id": "1014",
                        "name": "Store 1014",
                        "country_code": "CA",
                        "location_type": "store",
                        "on_hand": 4,
                        "in_transit": 0,
                        "positions": [
                          {
                            "lot_id": null,
                            "lot": null,
                            "expiry_date": null,
                            "variant_id": null,
                            "on_hand": 4,
                            "in_transit": 0,
                            "available": null,
                            "uom": null,
                            "as_of": "2026-11-21T09:18:07.131+00:00"
                          }
                        ]
                      }
                    ],
                    "open_purchase_orders": [
                      {
                        "purchase_order_id": "b146df89-af70-4e99-9567-2a2151619883",
                        "purchase_order": "PI-PO-00054",
                        "status": "open",
                        "supplier_id": "36ea46f6-9469-4695-86db-d789d4366d5e",
                        "line_id": "e54e0afe-afb9-4716-af11-39d5a53b733a",
                        "line_number": 1,
                        "location_id": "1d9028ab-f94d-4d6f-b0bb-982fdbc97837",
                        "location": "1003",
                        "variant_id": null,
                        "quantity_open": 98,
                        "expected_delivery_date": "2026-11-14"
                      }
                    ],
                    "inbound_ship_notices": [],
                    "trace": {
                      "tagged_units": true,
                      "lots": [],
                      "item": "MAT-00000001"
                    },
                    "truncated": {
                      "inventory": false,
                      "purchase_order_lines": false,
                      "ship_notices": false
                    }
                  },
                  "hold_tasks": [
                    {
                      "id": "0801202f-b592-47de-b5eb-95dcb6f4b015",
                      "status": "proposed",
                      "location_id": "28ee2961-0569-4379-83dd-21d62adcee36",
                      "quantity": 2,
                      "location": "1008",
                      "created_at": "2026-11-21T09:39:04.996697+00:00",
                      "primary": true,
                      "notices_total": 1
                    }
                  ],
                  "hold_tasks_truncated": false,
                  "second_opinion": {
                    "offered": false,
                    "not_offered": "match_decided",
                    "configured": false,
                    "cap": {
                      "limit": 50,
                      "used_today": 0,
                      "remaining": 50
                    },
                    "opinion": null
                  },
                  "lot_exposure": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "product_compliance",
        "x-writes": false
      }
    },
    "/v1/recalls/notices": {
      "get": {
        "operationId": "listRecallNotices",
        "summary": "Recent official product recall notices, newest first, with the issuing authority and a link to each notice",
        "description": "Key scope: read (or execute). Module: product_compliance. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `notices`, deprecated.",
        "tags": [
          "recalls"
        ],
        "parameters": [
          {
            "name": "jurisdiction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "EU",
                "CA",
                "GB",
                "AE"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Published on or after"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Deprecated: use from",
            "deprecated": true
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RecallNotice"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "notices": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RecallNotice"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "notices",
                    "next_offset",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "2e3f70b7-aa23-4a6e-937b-7ef06cd226d8",
                  "notices": [
                    {
                      "id": "0463e4b1-8c95-46f0-b72f-2a4f1ec35474",
                      "source": "us_consumer_products",
                      "source_id": "11064",
                      "notice_type": "recall",
                      "title": "Example Cycles Recalls Bicycle Helmets Due to Risk of Head Injury",
                      "published_on": "2026-11-19",
                      "jurisdiction": "US",
                      "product_name": "Example Cycles bike helmets",
                      "brand": null,
                      "url": "https://www.example.com/recalls/2026/bicycle-helmets",
                      "authority": "US Consumer Product Safety Commission"
                    }
                  ],
                  "has_more": true,
                  "next_offset": 25,
                  "object": "list",
                  "data": [
                    {
                      "id": "0463e4b1-8c95-46f0-b72f-2a4f1ec35474",
                      "source": "us_consumer_products",
                      "source_id": "11064",
                      "notice_type": "recall",
                      "title": "Example Cycles Recalls Bicycle Helmets Due to Risk of Head Injury",
                      "published_on": "2026-11-19",
                      "jurisdiction": "US",
                      "product_name": "Example Cycles bike helmets",
                      "brand": null,
                      "url": "https://www.example.com/recalls/2026/bicycle-helmets",
                      "authority": "US Consumer Product Safety Commission"
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "product_compliance",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "notices"
        }
      }
    },
    "/v1/recalls/own_recalls": {
      "get": {
        "operationId": "listOwnRecalls",
        "summary": "Your own recalls and withdrawals of lots (opened by your organization, not from an official notice), newest first",
        "description": "Key scope: read (or execute). Module: product_compliance. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `own_recalls`, deprecated.",
        "tags": [
          "recalls"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "closed"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OwnRecall"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "own_recalls": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OwnRecall"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "own_recalls",
                    "next_offset",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "1f2e3d4c-5b6a-4978-8a9b-0c1d2e3f4a5b",
                  "own_recalls": [
                    {
                      "id": "6b1f3c2e-8d4a-4e7b-9a10-3c5d7e9f1a2b",
                      "kind": "recall",
                      "status": "open",
                      "reason": "Foreign material found in a green coffee lot at the roastery",
                      "reference": "QA-0417",
                      "lot_ids": [
                        "2e7c9a41-5b3d-4f8e-a1c2-7d9e0f1b3c5a"
                      ],
                      "item_ids": [
                        "9d4e2f1a-7c3b-4a5e-8f6d-1b2c3d4e5f6a"
                      ],
                      "include_descendants": true,
                      "opened_by": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                      "opened_at": "2026-11-27T11:02:14.512+00:00",
                      "closed_by": null,
                      "closed_at": null,
                      "close_note": null,
                      "follow_up": {
                        "holds_proposed": 2,
                        "lots": 2,
                        "descendant_lots": 1,
                        "customers": 1,
                        "locations_with_stock": 2
                      },
                      "follow_up_done_at": "2026-11-27T11:02:14.903+00:00",
                      "created_at": "2026-11-27T11:02:14.512+00:00",
                      "updated_at": "2026-11-27T11:02:14.903+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_offset": null,
                  "object": "list",
                  "data": [
                    {
                      "id": "6b1f3c2e-8d4a-4e7b-9a10-3c5d7e9f1a2b",
                      "kind": "recall",
                      "status": "open",
                      "reason": "Foreign material found in a green coffee lot at the roastery",
                      "reference": "QA-0417",
                      "lot_ids": [
                        "2e7c9a41-5b3d-4f8e-a1c2-7d9e0f1b3c5a"
                      ],
                      "item_ids": [
                        "9d4e2f1a-7c3b-4a5e-8f6d-1b2c3d4e5f6a"
                      ],
                      "include_descendants": true,
                      "opened_by": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                      "opened_at": "2026-11-27T11:02:14.512+00:00",
                      "closed_by": null,
                      "closed_at": null,
                      "close_note": null,
                      "follow_up": {
                        "holds_proposed": 2,
                        "lots": 2,
                        "descendant_lots": 1,
                        "customers": 1,
                        "locations_with_stock": 2
                      },
                      "follow_up_done_at": "2026-11-27T11:02:14.903+00:00",
                      "created_at": "2026-11-27T11:02:14.512+00:00",
                      "updated_at": "2026-11-27T11:02:14.903+00:00"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "product_compliance",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "own_recalls"
        }
      }
    },
    "/v1/recalls/own_recalls/{id}": {
      "get": {
        "operationId": "getOwnRecall",
        "summary": "One of your own recalls with its lots: the lots named, the lots made from them, stock by lot and location, the customers who received them, and its hold tasks",
        "description": "Key scope: read (or execute). Module: product_compliance. at most 50 lots named; the exposure reads at most 2,000 lots, 5,000 stock rows and 5,000 delivery lines (`lot_exposure.truncated` says which were cut); at most 200 hold tasks",
        "tags": [
          "recalls"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "own_recall": {
                      "$ref": "#/components/schemas/OwnRecall"
                    },
                    "lot_exposure": {
                      "$ref": "#/components/schemas/RecallLotExposure"
                    },
                    "hold_tasks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "proposed",
                              "approved",
                              "dismissed",
                              "expired",
                              "superseded"
                            ]
                          },
                          "item_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "lot_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "location_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "quantity": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "location": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lot": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "item_id",
                          "lot_id",
                          "location_id",
                          "quantity",
                          "location",
                          "lot",
                          "created_at"
                        ]
                      }
                    },
                    "hold_tasks_truncated": {
                      "type": "boolean"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "own_recall",
                    "lot_exposure",
                    "hold_tasks",
                    "hold_tasks_truncated",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "3b4c5d6e-7f8a-4b9c-8d0e-2f3a4b5c6d7e",
                  "own_recall": {
                    "id": "6b1f3c2e-8d4a-4e7b-9a10-3c5d7e9f1a2b",
                    "kind": "recall",
                    "status": "open",
                    "reason": "Foreign material found in a green coffee lot at the roastery",
                    "reference": "QA-0417",
                    "lot_ids": [
                      "2e7c9a41-5b3d-4f8e-a1c2-7d9e0f1b3c5a"
                    ],
                    "item_ids": [
                      "9d4e2f1a-7c3b-4a5e-8f6d-1b2c3d4e5f6a"
                    ],
                    "include_descendants": true,
                    "opened_by": "daa1ddbf-97c2-446e-88c8-1e7185d6384c",
                    "opened_at": "2026-11-27T11:02:14.512+00:00",
                    "closed_by": null,
                    "closed_at": null,
                    "close_note": null,
                    "follow_up": {
                      "holds_proposed": 2,
                      "lots": 2,
                      "descendant_lots": 1,
                      "customers": 1,
                      "locations_with_stock": 2
                    },
                    "follow_up_done_at": "2026-11-27T11:02:14.903+00:00",
                    "created_at": "2026-11-27T11:02:14.512+00:00",
                    "updated_at": "2026-11-27T11:02:14.903+00:00"
                  },
                  "lot_exposure": {
                    "status": "lots",
                    "lot_codes": [],
                    "matched_codes": [],
                    "unmatched_codes": [],
                    "lots": [
                      {
                        "lot_id": "2e7c9a41-5b3d-4f8e-a1c2-7d9e0f1b3c5a",
                        "item_id": "9d4e2f1a-7c3b-4a5e-8f6d-1b2c3d4e5f6a",
                        "item": "GREEN-BR-01",
                        "item_description": "Green coffee, Brazil",
                        "lot_code": "G-4471",
                        "external_id": "GL-2026-4471",
                        "expiry_date": null,
                        "relation": "named",
                        "matched_by": "selected",
                        "made_from": [],
                        "depth": 0
                      },
                      {
                        "lot_id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d",
                        "item_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                        "item": "ROAST-1KG",
                        "item_description": "Roasted coffee beans, 1 kg",
                        "lot_code": "R-0902",
                        "external_id": "FL-2026-0902",
                        "expiry_date": "2027-05-31",
                        "relation": "descendant",
                        "matched_by": "genealogy",
                        "made_from": [
                          "2e7c9a41-5b3d-4f8e-a1c2-7d9e0f1b3c5a"
                        ],
                        "depth": 1
                      }
                    ],
                    "stock": [
                      {
                        "lot_id": "2e7c9a41-5b3d-4f8e-a1c2-7d9e0f1b3c5a",
                        "item_id": "9d4e2f1a-7c3b-4a5e-8f6d-1b2c3d4e5f6a",
                        "location_id": "7f8e9d0c-1b2a-4c3d-9e4f-5a6b7c8d9e0f",
                        "location": "PLANT-01",
                        "location_name": "Roastery",
                        "country_code": "US",
                        "on_hand": 4800,
                        "in_transit": 0,
                        "uom": "KG"
                      },
                      {
                        "lot_id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d",
                        "item_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                        "location_id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
                        "location": "DC-EAST",
                        "location_name": "East distribution centre",
                        "country_code": "US",
                        "on_hand": 640,
                        "in_transit": 120,
                        "uom": "EA"
                      }
                    ],
                    "deliveries": [
                      {
                        "delivery_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
                        "delivery": "80004417",
                        "lot_id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d",
                        "item_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                        "customer_id": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
                        "customer": "C-1001",
                        "customer_name": "Example Grocers",
                        "ship_to": "C-1001-07",
                        "quantity": 96,
                        "uom": "EA",
                        "status": "completed",
                        "goods_issued_at": "2026-11-24T14:30:00+00:00",
                        "delivery_date": "2026-11-25"
                      }
                    ],
                    "customers": [
                      {
                        "customer_id": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
                        "customer": "C-1001",
                        "name": "Example Grocers",
                        "deliveries": 1,
                        "quantity": 96,
                        "lots": [
                          "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d"
                        ]
                      }
                    ],
                    "totals": {
                      "lots": 2,
                      "descendant_lots": 1,
                      "on_hand": 5440,
                      "in_transit": 120,
                      "locations_with_stock": 2,
                      "customers": 1,
                      "delivered_quantity": 96
                    },
                    "genealogy": "read",
                    "truncated": {
                      "lots": false,
                      "stock": false,
                      "deliveries": false,
                      "genealogy": false
                    }
                  },
                  "hold_tasks": [
                    {
                      "id": "8e9f0a1b-2c3d-4e5f-9a6b-7c8d9e0f1a2b",
                      "status": "proposed",
                      "item_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                      "lot_id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d",
                      "location_id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
                      "quantity": 760,
                      "location": "DC-EAST",
                      "lot": "FL-2026-0902",
                      "created_at": "2026-11-27T11:02:14.870+00:00"
                    }
                  ],
                  "hold_tasks_truncated": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "product_compliance",
        "x-writes": false
      }
    },
    "/v1/recommendations": {
      "get": {
        "operationId": "listRecommendations",
        "summary": "Recommendations from every agent with their status, newest first",
        "description": "Key scope: read (or execute). Module: recommendations. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `recommendations`, deprecated.",
        "tags": [
          "recommendations"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "proposed",
                "approved",
                "dismissed",
                "expired",
                "superseded"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            },
            "description": "Only this kind, exactly as a row's kind field gives it, e.g. rebalance or purchase"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Recommendation"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "recommendations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Recommendation"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "recommendations",
                    "next_offset",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "3ec0fb6e-c892-4914-8d6e-27407d773db9",
                  "recommendations": [
                    {
                      "id": "fea148ac-92ae-4370-b44b-62bfc83c2470",
                      "kind": "purchase",
                      "status": "proposed",
                      "quantity": 120,
                      "priority": 82,
                      "rationale": {
                        "on_hand": 64,
                        "reorder_point": 180,
                        "order_up_to_level": 300,
                        "days_of_cover": 4.5,
                        "lead_time_days": 21,
                        "supplier": "VEND-000020"
                      },
                      "expected_impact": {
                        "recommended_action": "purchase",
                        "estimated_value": 7554,
                        "stockout_risk_before": 0.42
                      },
                      "data_as_of": "2026-11-21T10:56:02.819+00:00",
                      "status_changed_by": null,
                      "status_changed_at": null,
                      "superseded_at": null,
                      "created_at": "2026-11-21T10:56:02.901975+00:00",
                      "updated_at": "2026-11-21T10:56:02.901975+00:00",
                      "item": {
                        "external_id": "MAT-00000029",
                        "description": "Handbags - Style 00000029"
                      },
                      "from_location": null,
                      "to_location": {
                        "external_id": "1010",
                        "name": "Store 1010"
                      }
                    }
                  ],
                  "has_more": true,
                  "next_offset": 50,
                  "object": "list",
                  "data": [
                    {
                      "id": "fea148ac-92ae-4370-b44b-62bfc83c2470",
                      "kind": "purchase",
                      "status": "proposed",
                      "quantity": 120,
                      "priority": 82,
                      "rationale": {
                        "on_hand": 64,
                        "reorder_point": 180,
                        "order_up_to_level": 300,
                        "days_of_cover": 4.5,
                        "lead_time_days": 21,
                        "supplier": "VEND-000020"
                      },
                      "expected_impact": {
                        "recommended_action": "purchase",
                        "estimated_value": 7554,
                        "stockout_risk_before": 0.42
                      },
                      "data_as_of": "2026-11-21T10:56:02.819+00:00",
                      "status_changed_by": null,
                      "status_changed_at": null,
                      "superseded_at": null,
                      "created_at": "2026-11-21T10:56:02.901975+00:00",
                      "updated_at": "2026-11-21T10:56:02.901975+00:00",
                      "item": {
                        "external_id": "MAT-00000029",
                        "description": "Handbags - Style 00000029"
                      },
                      "from_location": null,
                      "to_location": {
                        "external_id": "1010",
                        "name": "Store 1010"
                      }
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "recommendations",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "recommendations"
        }
      }
    },
    "/v1/recommendations/{id}": {
      "get": {
        "operationId": "getRecommendation",
        "summary": "One recommendation",
        "description": "Key scope: read (or execute). Module: recommendations.",
        "tags": [
          "recommendations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "recommendation": {
                      "$ref": "#/components/schemas/Recommendation"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "recommendation",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "91b82ec7-611f-4810-9c25-dc0abfbbe4ef",
                  "recommendation": {
                    "id": "fea148ac-92ae-4370-b44b-62bfc83c2470",
                    "kind": "purchase",
                    "status": "proposed",
                    "quantity": 120,
                    "priority": 82,
                    "rationale": {
                      "on_hand": 64,
                      "reorder_point": 180,
                      "order_up_to_level": 300,
                      "days_of_cover": 4.5,
                      "lead_time_days": 21,
                      "supplier": "VEND-000020"
                    },
                    "expected_impact": {
                      "recommended_action": "purchase",
                      "estimated_value": 7554,
                      "stockout_risk_before": 0.42
                    },
                    "data_as_of": "2026-11-21T10:56:02.819+00:00",
                    "status_changed_by": null,
                    "status_changed_at": null,
                    "superseded_at": null,
                    "created_at": "2026-11-21T10:56:02.901975+00:00",
                    "updated_at": "2026-11-21T10:56:02.901975+00:00",
                    "item": {
                      "external_id": "MAT-00000029",
                      "description": "Handbags - Style 00000029"
                    },
                    "from_location": null,
                    "to_location": {
                      "external_id": "1010",
                      "name": "Store 1010"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "recommendations",
        "x-writes": false
      }
    },
    "/v1/recommendations/{id}/approve": {
      "post": {
        "operationId": "approveRecommendation",
        "summary": "Approve a recommendation (the key's creator must still be a member). Takes no body",
        "description": "Key scope: execute. Module: recommendations.",
        "tags": [
          "recommendations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "recommendation": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "approved",
                            "dismissed"
                          ]
                        },
                        "status_changed_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "status_changed_at"
                      ]
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "recommendation",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "41f983c7-9268-442f-96b3-b50fce6dea01",
                  "recommendation": {
                    "id": "f8e6143e-c035-4675-9c98-d87d6870e583",
                    "status": "approved",
                    "status_changed_at": "2026-11-21T10:56:03.532+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "recommendations",
        "x-writes": true
      }
    },
    "/v1/recommendations/{id}/dismiss": {
      "post": {
        "operationId": "dismissRecommendation",
        "summary": "Dismiss a recommendation (the key's creator must still be a member). Takes no body",
        "description": "Key scope: execute. Module: recommendations.",
        "tags": [
          "recommendations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "recommendation": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "approved",
                            "dismissed"
                          ]
                        },
                        "status_changed_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "status_changed_at"
                      ]
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "recommendation",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "65427589-aabb-4b7b-93c7-50fce67759f2",
                  "recommendation": {
                    "id": "f70b962e-4dba-49e6-aebc-496474c9927e",
                    "status": "dismissed",
                    "status_changed_at": "2026-11-21T10:56:03.547+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "recommendations",
        "x-writes": true
      }
    },
    "/v1/recommendations/{id}/status": {
      "post": {
        "operationId": "setRecommendationStatus",
        "summary": "Approve or dismiss a recommendation, the status in the body (the key's creator must still be a member). The same as /approve and /dismiss",
        "description": "Key scope: execute. Module: recommendations.",
        "tags": [
          "recommendations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "approved",
                      "dismissed"
                    ]
                  }
                },
                "required": [
                  "status"
                ],
                "additionalProperties": false
              },
              "example": {
                "status": "approved"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "recommendation": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "approved",
                            "dismissed"
                          ]
                        },
                        "status_changed_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "status_changed_at"
                      ]
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "recommendation",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "f708f4e8-08d5-46fc-b287-6dceb729e385",
                  "recommendation": {
                    "id": "fea148ac-92ae-4370-b44b-62bfc83c2470",
                    "status": "approved",
                    "status_changed_at": "2026-11-21T10:56:03.504+00:00"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "execute",
        "x-module": "recommendations",
        "x-writes": true
      }
    },
    "/v1/request_logs": {
      "get": {
        "operationId": "listRequestLogs",
        "summary": "The calls made with your organization's keys in the last 30 days, newest first: route, status, latency, request id. Find one call with request_id",
        "description": "Key scope: read (or execute). Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "request_logs"
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "client_request_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "The X-Request-ID your client sent"
          },
          {
            "name": "api_key_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            "description": "The HTTP status of the answer"
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "success",
                "error",
                "client_error",
                "server_error",
                "rate_limited"
              ]
            },
            "description": "success: below 400; error: 400 and above; client_error: 4xx except 429; server_error: 500 and above; rate_limited: 429"
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "GET",
                "POST",
                "PUT",
                "PATCH",
                "DELETE"
              ]
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "live",
                "test"
              ]
            },
            "description": "A key reads its own environment only: the other value returns nothing"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Calls at or after this: an ISO date (midnight UTC) or an RFC 3339 date-time"
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Calls before this: an ISO date (midnight UTC) or an RFC 3339 date-time. Exclusive, so a bare date leaves that day out"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RequestLogEntry"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "retention_days": {
                      "type": "integer",
                      "description": "Days the log is kept"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "retention_days",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "e545cb5c-2f54-48b4-b764-6bf1ed285701",
                  "data": [
                    {
                      "request_id": "aa9888e7-e550-4672-80f0-1313adce0851",
                      "client_request_id": null,
                      "api_key_id": "ed9b1e32-1e24-4ad0-a3b9-0d417e0f4685",
                      "environment": "live",
                      "method": "POST",
                      "route": "/api_keys/{id}/rotate",
                      "status": 200,
                      "error_code": null,
                      "latency_ms": 14,
                      "via": "http",
                      "credential": "key",
                      "created_at": "2026-11-21T16:04:19.953277+00:00"
                    }
                  ],
                  "has_more": true,
                  "next_cursor": "example-token",
                  "retention_days": 30,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/sync_runs": {
      "get": {
        "operationId": "listSyncRuns",
        "summary": "Sync runs with counts and errors (secrets redacted)",
        "description": "Key scope: read (or execute). Module: connectors. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `sync_runs`, deprecated. Each run lists at most 50 record errors, each with at most 20 field messages; `error_count` is the full number",
        "tags": [
          "sync_runs"
        ],
        "parameters": [
          {
            "name": "connection_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "success",
                "partial",
                "failed"
              ]
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Runs started at or after this: an ISO date (midnight UTC) or an RFC 3339 date-time"
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Runs started before this: an ISO date (midnight UTC) or an RFC 3339 date-time. Must be after since"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000,
              "default": 0
            },
            "deprecated": true
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page. Opaque; valid only with the same filters"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SyncRun"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "sync_runs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SyncRun"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "deprecated": true,
                      "description": "Deprecated: page with next_cursor"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "sync_runs",
                    "next_offset",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "cb43c198-175c-420d-beb6-e117aaa4110e",
                  "sync_runs": [
                    {
                      "id": "b6a7e229-cf08-4e2c-8d0b-58bd086b5e69",
                      "connection_id": "ca8e6d25-ccb3-4299-b751-4cca0de35a32",
                      "request_id": "52e718a7-a94f-45f6-9047-9d73b7964770",
                      "api_key_id": "838e6ccc-3103-427e-b426-a856c136d7e6",
                      "status": "success",
                      "entity_counts": {
                        "items": {
                          "received": 1,
                          "upserted": 1,
                          "failed": 0
                        },
                        "returns": {
                          "received": 0,
                          "upserted": 0,
                          "failed": 0
                        }
                      },
                      "error_count": 0,
                      "errors": [],
                      "started_at": "2026-11-21T10:55:52.809843+00:00",
                      "finished_at": "2026-11-21T10:55:52.815+00:00",
                      "duration_ms": 11
                    }
                  ],
                  "has_more": true,
                  "next_offset": 50,
                  "object": "list",
                  "data": [
                    {
                      "id": "b6a7e229-cf08-4e2c-8d0b-58bd086b5e69",
                      "connection_id": "ca8e6d25-ccb3-4299-b751-4cca0de35a32",
                      "request_id": "52e718a7-a94f-45f6-9047-9d73b7964770",
                      "api_key_id": "838e6ccc-3103-427e-b426-a856c136d7e6",
                      "status": "success",
                      "entity_counts": {
                        "items": {
                          "received": 1,
                          "upserted": 1,
                          "failed": 0
                        },
                        "returns": {
                          "received": 0,
                          "upserted": 0,
                          "failed": 0
                        }
                      },
                      "error_count": 0,
                      "errors": [],
                      "started_at": "2026-11-21T10:55:52.809843+00:00",
                      "finished_at": "2026-11-21T10:55:52.815+00:00",
                      "duration_ms": 11
                    }
                  ],
                  "next_cursor": "example-token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "connectors",
        "x-writes": false,
        "x-list": {
          "paging": "cursor",
          "deprecated_field": "sync_runs"
        }
      }
    },
    "/v1/tariff_checks": {
      "post": {
        "operationId": "createTariffCheck",
        "summary": "Duty for an HS code (or a description to classify) from an origin into the US, UK, EU, Canada, the UAE, Saudi Arabia or Egypt, with FTA eligibility and surcharges. One of hs_code or item_description is required. The lookup is logged and cached",
        "description": "Key scope: read (or execute). Module: tariff. `related_announcements` lists at most 5 announcements, newest first",
        "tags": [
          "tariff_checks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hs_code": {
                    "type": "string",
                    "maxLength": 17,
                    "description": "HS code, 6-10 digits (up to 12 for the UAE and Saudi Arabia); dots between groups are allowed. Required unless item_description is sent"
                  },
                  "item_description": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Used to classify when hs_code is absent. Required unless hs_code is sent"
                  },
                  "origin_country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "ISO 3166-1 alpha-2 country code"
                  },
                  "destination_country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$",
                    "description": "US (default), GB, CA, AE, SA, EG, or an EU member state"
                  },
                  "check_date": {
                    "type": "string",
                    "format": "date",
                    "description": "Rates in force on this date (default today)"
                  }
                },
                "required": [
                  "origin_country"
                ],
                "additionalProperties": false
              },
              "example": {
                "hs_code": "6109.10",
                "origin_country": "VN",
                "destination_country": "US"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TariffCheck"
                },
                "example": {
                  "origin": "CN",
                  "source": {
                    "url": "https://hts.usitc.gov/view/subheading?subheading=610910",
                    "name": "Harmonized Tariff Schedule of the United States",
                    "as_of": "2026-11-21",
                    "licence": null,
                    "authority": "us_official_schedule"
                  },
                  "hs_code": "6109.10",
                  "hs_match": {
                    "rates": [
                      "16.5%"
                    ],
                    "typed": "6109.10",
                    "matched": "6109.10.00",
                    "precision": "exact",
                    "candidate_count": 1
                  },
                  "base_rate": {
                    "rate": "16.5%",
                    "type": "MFN Duty",
                    "source": "Harmonized Tariff Schedule of the United States",
                    "special": "Free (AU,BH,CL,CO,IL,JO,KR,MA,OM,P,PA,PE,S,SG)",
                    "source_url": "https://hts.usitc.gov/view/subheading?subheading=610910",
                    "rate_percent": 16.5
                  },
                  "check_date": "2026-11-21",
                  "request_id": "ebea843a-3c4c-4413-8e7d-5ae00f7cb6cc",
                  "description": "Of cotton",
                  "destination": "US",
                  "rate_status": "official",
                  "specific_duty": null,
                  "effective_rate": "31.5%",
                  "cbp_restrictions": {
                    "notes": [],
                    "prohibited": false,
                    "restrictions": [
                      {
                        "agency": "FTC",
                        "source": "curated",
                        "verified": true,
                        "requirement": "FTC textile labeling requirements (fiber content, country of origin, manufacturer)."
                      }
                    ],
                    "model_assisted": false,
                    "prohibited_source": null,
                    "column2_prohibited": false
                  },
                  "additional_duties": [
                    {
                      "rate": "15%",
                      "type": "Import Surcharge",
                      "origin": "announcement",
                      "source": "Temporary 15% import surcharge on all goods entering the United States under Section 122 of the Trade Act of 1974.",
                      "heading": null,
                      "source_url": "https://www.whitehouse.gov/presidential-actions/2026/02/imposing-a-temporary-import-surcharge/",
                      "rate_percent": 15,
                      "published_date": "2026-02-15T00:00:00+00:00"
                    }
                  ],
                  "destination_region": "US",
                  "destination_country": "US",
                  "effective_ad_valorem_percent": 31.5,
                  "cache_hit": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/Timeout"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false
      }
    },
    "/v1/trade/announcements": {
      "get": {
        "operationId": "listTradeAnnouncements",
        "summary": "Trade announcements",
        "description": "Key scope: read (or execute). Module: tariff. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Deprecated: use from",
            "deprecated": true
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day"
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Deprecated: use to",
            "deprecated": true
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TradeAnnouncement"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date",
                          "description": "The `from` filter"
                        },
                        "to": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date",
                          "description": "The `to` filter"
                        },
                        "processed": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "from",
                        "to",
                        "processed"
                      ],
                      "description": "The filters as applied"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "28b1bc13-e803-4a69-aea1-0cb1603a8147",
                  "filters": {
                    "from": null,
                    "to": null,
                    "processed": null
                  },
                  "data": [
                    {
                      "id": "c2befa58-de0c-49d0-939d-e48253eab279",
                      "title": "Fact Sheet: President Donald J. Trump Responds to Canada’s Retaliation",
                      "url": "https://www.whitehouse.gov/fact-sheets/2026/09/fact-sheet-president-donald-j-trump-responds-to-canadas-retaliation/",
                      "published_date": "2026-09-09T01:38:43+00:00",
                      "source_type": "news",
                      "processed": true,
                      "created_at": "2026-09-09T03:00:14.358658+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/trade/classification/candidates": {
      "get": {
        "operationId": "listClassificationCandidates",
        "summary": "Candidate tariff lines for a product description, ranked, each with its evidence",
        "description": "Key scope: read (or execute). Module: tariff.",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "schedule",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "CA",
                "AE"
              ],
              "default": "US"
            }
          },
          {
            "name": "description",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 500
            },
            "description": "The product description, at most 500 characters"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "The item's category in your own item master: your items of the same category count for more"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedule": {
                      "type": "string",
                      "enum": [
                        "US",
                        "CA",
                        "AE"
                      ],
                      "description": "The tariff schedule the codes are checked against"
                    },
                    "description": {
                      "type": "string"
                    },
                    "category": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "decided",
                        "ambiguous",
                        "none"
                      ],
                      "description": "decided: one line is clearly first. ambiguous: there are candidates and a person has to choose. none: nothing resembles the description"
                    },
                    "reason": {
                      "type": "string",
                      "description": "One sentence saying why"
                    },
                    "choice": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/ClassificationCandidate",
                          "description": "The line chosen, when status is decided"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "candidates": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ClassificationCandidate"
                      },
                      "description": "Every candidate, ranked; at most 8"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "schedule",
                    "description",
                    "category",
                    "status",
                    "reason",
                    "choice",
                    "candidates",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "d85225e6-cac5-417e-8ee2-f85cb088532f",
                  "schedule": "US",
                  "description": "Leather shoulder bag",
                  "category": "Handbags",
                  "status": "decided",
                  "reason": "One of your own items with a close description already carries this code.",
                  "choice": {
                    "code": "4202219000",
                    "code_display": "4202.21.90.00",
                    "description": "Handbags, whether or not with shoulder strap, including those without handle > With outer surface of leather or of composition leather > Other > Valued over $20 each",
                    "duty_rate": "9%",
                    "declarable": true,
                    "source": "own_item",
                    "also_from": [
                      "schedule"
                    ],
                    "score": 0.86,
                    "evidence": {
                      "item": "MAT-00000001",
                      "item_description": "Leather shoulder bag, medium",
                      "similar_items_with_this_code": 4
                    }
                  },
                  "candidates": [
                    {
                      "code": "4202219000",
                      "code_display": "4202.21.90.00",
                      "description": "Handbags, whether or not with shoulder strap, including those without handle > With outer surface of leather or of composition leather > Other > Valued over $20 each",
                      "duty_rate": "9%",
                      "declarable": true,
                      "source": "own_item",
                      "also_from": [
                        "schedule"
                      ],
                      "score": 0.86,
                      "evidence": {
                        "item": "MAT-00000001",
                        "item_description": "Leather shoulder bag, medium",
                        "similar_items_with_this_code": 4
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false
      }
    },
    "/v1/trade/classification/items": {
      "get": {
        "operationId": "listClassificationItems",
        "summary": "Your items with the state of each one's commodity code",
        "description": "Key scope: read (or execute). Module: tariff. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "schedule",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "CA",
                "AE"
              ],
              "default": "US"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "valid",
                "too_general",
                "not_listed",
                "retired",
                "missing"
              ]
            },
            "description": "valid: a line a declaration can name; too_general: a line with lines under it; not_listed: the schedule has never had the code; retired: a line of an earlier edition; missing: the item has no code"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ClassificationItem"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "schedule": {
                          "type": "string",
                          "enum": [
                            "US",
                            "CA",
                            "AE"
                          ],
                          "description": "The tariff schedule the codes are checked against"
                        },
                        "state": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "valid",
                            "too_general",
                            "not_listed",
                            "retired",
                            "missing",
                            null
                          ],
                          "description": "valid: a line of the schedule a declaration can name. too_general: a line with lines under it. not_listed: the schedule has never had this code. retired: a line of an earlier edition, no longer in the schedule. missing: the item has no code"
                        }
                      },
                      "required": [
                        "schedule",
                        "state"
                      ],
                      "description": "The filters as applied"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "9a1f6f0e-2c58-4d0f-9d2b-5f6a8f1f7c11",
                  "object": "list",
                  "filters": {
                    "schedule": "US",
                    "state": "too_general"
                  },
                  "data": [
                    {
                      "item_id": "6f0d1c3e-51a7-4b7e-9c55-0f3a2b8d4e21",
                      "external_id": "MAT-00000007",
                      "description": "Leather ankle boot, rubber sole",
                      "category": "Footwear",
                      "hs_code": "6403.99",
                      "code": "640399",
                      "state": "too_general",
                      "line_description": "Footwear with outer soles of rubber, plastics, leather or composition leather and uppers of leather > Other footwear > Other",
                      "mfn_display": null,
                      "lines_under": 31,
                      "same_rate": false,
                      "retired_at": null,
                      "retired_edition": null,
                      "nearest_code": null
                    }
                  ],
                  "has_more": true,
                  "next_cursor": "eyJvIjoxfQ"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/trade/classification/summary": {
      "get": {
        "operationId": "getClassificationSummary",
        "summary": "Your items' commodity codes checked against the tariff schedule, counted by state",
        "description": "Key scope: read (or execute). Module: tariff.",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "schedule",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "CA",
                "AE"
              ],
              "default": "US"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedule": {
                      "type": "string",
                      "enum": [
                        "US",
                        "CA",
                        "AE"
                      ],
                      "description": "The tariff schedule the codes are checked against"
                    },
                    "edition": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The edition of the schedule in store; null until one has been loaded"
                    },
                    "loaded_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "schedule_lines": {
                      "type": "integer",
                      "description": "Lines of the schedule in force"
                    },
                    "items": {
                      "type": "integer",
                      "description": "Your items"
                    },
                    "valid": {
                      "type": "integer"
                    },
                    "too_general": {
                      "type": "integer"
                    },
                    "not_listed": {
                      "type": "integer"
                    },
                    "retired": {
                      "type": "integer"
                    },
                    "missing": {
                      "type": "integer"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "schedule",
                    "edition",
                    "loaded_at",
                    "schedule_lines",
                    "items",
                    "valid",
                    "too_general",
                    "not_listed",
                    "retired",
                    "missing",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "4b839cf9-d97e-4143-b025-440fe224ac65",
                  "schedule": "US",
                  "edition": "2026HTSRev23",
                  "loaded_at": "2026-11-27T03:37:04.414777+00:00",
                  "schedule_lines": 29861,
                  "items": 802,
                  "valid": 790,
                  "too_general": 6,
                  "not_listed": 3,
                  "retired": 1,
                  "missing": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false
      }
    },
    "/v1/trade/country_risks": {
      "get": {
        "operationId": "listCountryRisks",
        "summary": "Country risk profiles",
        "description": "Key scope: read (or execute). Module: location_risk. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "ISO 3166-1 alpha-2 country code"
          },
          {
            "name": "risk_level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "LOW",
                "MEDIUM",
                "ELEVATED",
                "HIGH",
                "CRITICAL",
                "BLOCKED"
              ]
            }
          },
          {
            "name": "sanctioned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CountryRiskProfile"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "risk_level": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "LOW",
                            "MEDIUM",
                            "ELEVATED",
                            "HIGH",
                            "CRITICAL",
                            "BLOCKED",
                            null
                          ]
                        },
                        "sanctioned": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "country",
                        "risk_level",
                        "sanctioned"
                      ],
                      "description": "The filters as applied"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "72e4849e-d0a9-451f-8427-91accd422da9",
                  "filters": {
                    "country": null,
                    "risk_level": null,
                    "sanctioned": null
                  },
                  "data": [
                    {
                      "country_code": "AE",
                      "country_name": "United Arab Emirates",
                      "risk_level": "MEDIUM",
                      "sanctioned": false,
                      "embargo_type": "none",
                      "sanctions_programs": [],
                      "risk_factors": [
                        "U.S. State Department travel advisory – Level 3: Reconsider Travel"
                      ],
                      "fatf_status": "clear",
                      "fatf_list_date": null,
                      "cpi_tier": "high",
                      "ear_group": "A:5,B",
                      "derivation": {
                        "cpi": {
                          "year": 2025,
                          "score": 69
                        },
                        "ear_groups": [
                          "A:5"
                        ],
                        "eu_regimes": [],
                        "fatf_status": "clear",
                        "ofac_programs": [],
                        "eu_sector_measures": 0,
                        "travel_advisory_level": 3
                      },
                      "derived_at": "2026-11-21T09:18:42.235+00:00",
                      "updated_at": "2026-11-21T09:18:42.235+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "location_risk",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/trade/duty_orders": {
      "get": {
        "operationId": "listDutyOrders",
        "summary": "Anti-dumping and countervailing duty orders",
        "description": "Key scope: read (or execute). Module: tariff. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "ISO 3166-1 alpha-2 country code"
          },
          {
            "name": "hs_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 14
            },
            "description": "HS code or a prefix of one, 4 to 10 digits; dots between groups are allowed. A shorter code also returns the orders that may cover it"
          },
          {
            "name": "case_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "AD",
                "CVD"
              ]
            },
            "description": "AD: anti-dumping; CVD: countervailing"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "revoked",
                "unconfirmed",
                "suspended"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DutyOrder"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "hs_code": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The code asked for, digits only"
                        },
                        "case_type": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "AD",
                            "CVD",
                            null
                          ]
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "active",
                            "revoked",
                            "unconfirmed",
                            "suspended",
                            null
                          ]
                        }
                      },
                      "required": [
                        "country",
                        "hs_code",
                        "case_type",
                        "status"
                      ],
                      "description": "The filters as applied"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Orders matching the filters, over every page"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "total",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "8db621c8-d31e-438c-8595-658f72dab9c1",
                  "filters": {
                    "country": null,
                    "hs_code": null,
                    "case_type": null,
                    "status": null
                  },
                  "total": 44,
                  "data": [
                    {
                      "id": "53712992-46c8-4cee-aba2-e9f7a21d3e75",
                      "case_number": "A-533-840",
                      "case_type": "AD",
                      "country_code": "IN",
                      "country_name": "India",
                      "product_description": "Certain Frozen Warmwater Shrimp",
                      "hs_code_prefixes": [
                        "0306.17"
                      ],
                      "rate_percent": null,
                      "rate_range_min": 0,
                      "rate_range_max": 10.17,
                      "all_others_rate": 10.17,
                      "status": "active",
                      "active": true,
                      "effective_date": "2005-02-01",
                      "revoked_date": null,
                      "continued_date": null,
                      "federal_register_citation": "70 FR 5152",
                      "source_url": "https://www.trade.gov/antidumping-duty-orders-force",
                      "origin": "reviewed",
                      "hs_source": "reviewed",
                      "rate_source": "reviewed",
                      "rate_basis": null,
                      "source_seen_at": null,
                      "updated_at": "2026-11-21T09:17:46.317564+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/trade/tariff_actions": {
      "get": {
        "operationId": "listTariffActions",
        "summary": "Tariff actions in force or announced. A measure read from an announcement is listed only once it has been reviewed and confirmed",
        "description": "Key scope: read (or execute). Module: tariff. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "importing_country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "CA"
              ],
              "default": "Who charges the duty (default US)"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "ISO 3166-1 alpha-2 country code"
          },
          {
            "name": "origin",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "announcement",
                "schedule",
                "official_list"
              ]
            }
          },
          {
            "name": "active",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TariffAction"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "importing_country": {
                          "type": "string",
                          "enum": [
                            "US",
                            "CA"
                          ]
                        },
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "origin": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "announcement",
                            "schedule",
                            "official_list",
                            null
                          ]
                        },
                        "active": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "importing_country",
                        "country",
                        "origin",
                        "active"
                      ],
                      "description": "The filters as applied"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "9d150f1b-396e-4e11-8c0f-077e89cbf278",
                  "filters": {
                    "importing_country": "US",
                    "country": null,
                    "origin": null,
                    "active": true
                  },
                  "data": [
                    {
                      "id": "d76a9df8-7925-4fcb-9376-a62d308a0634",
                      "importing_country": "US",
                      "action_type": "Section 232",
                      "rate": 0,
                      "rate_type": "percentage",
                      "applies_globally": true,
                      "affected_countries": [],
                      "affected_hs_codes": [],
                      "excluded_hs_codes": [],
                      "except_headings": [],
                      "effective_date": "2026-12-04",
                      "expiry_date": null,
                      "origin": "announcement",
                      "heading": null,
                      "source_description": "Imposes a 15% ad valorem duty on polysilicon derivatives and establishes a Minimum Import Price (MIP) program for polysilicon, ingots, wa...",
                      "source_url": null,
                      "active": true,
                      "source_announcement_id": "94c106b5-1dcb-4b73-8d37-7b7bddb1a593",
                      "updated_at": "2026-08-06T22:00:29.927426+00:00",
                      "announcement": {
                        "url": "https://www.whitehouse.gov/presidential-actions/2026/08/adjusting-imports-of-polysilicon-and-its-derivatives-into-the-united-states/",
                        "title": "Adjusting Imports of Polysilicon and its Derivatives into the United States",
                        "published_date": "2026-08-06T21:03:35+00:00"
                      }
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/trade/tariff_impact/briefs": {
      "get": {
        "operationId": "listTariffImpactBriefs",
        "summary": "Written tariff impact briefs",
        "description": "Key scope: read (or execute). Module: tariff. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "action_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "A tariff action's id (GET /v1/trade/tariff_actions): only the briefs written for it"
          },
          {
            "name": "override_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Deprecated: use action_id",
            "deprecated": true
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Deprecated: use from",
            "deprecated": true
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day"
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Deprecated: use to",
            "deprecated": true
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TariffImpactBrief"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "action_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "from": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date",
                          "description": "The `from` filter"
                        },
                        "to": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date",
                          "description": "The `to` filter"
                        }
                      },
                      "required": [
                        "action_id",
                        "from",
                        "to"
                      ],
                      "description": "The filters as applied"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "5de533bd-4935-4a0f-b376-29606a65a924",
                  "filters": {
                    "action_id": null,
                    "from": null,
                    "to": null
                  },
                  "data": [
                    {
                      "id": "3f6b1c2d-9a8e-4b7c-8d6f-1e2a3b4c5d6e",
                      "action_id": "d76a9df8-7925-4fcb-9376-a62d308a0634",
                      "action_version": "2026-03-12:25",
                      "action_type": "Section 232",
                      "heading": "9903.81.90",
                      "rate_percent": 25,
                      "countries": [],
                      "applies_globally": true,
                      "effective_date": "2026-03-12",
                      "headline": "A 25% duty on steel and aluminium derivatives adds about $18,400 to 9 open orders",
                      "paragraphs": [
                        "14 of your items fall under the action, from 3 suppliers. The open orders for them are worth $73,682; the added duty on them is $18,420.",
                        "One supplier outside the action's reach has supplied one of these items before."
                      ],
                      "actions": [
                        "Ask Monterrey Housewares 0044 for a quote on MAT-00000118",
                        "Check the classification of the two items under heading 7615"
                      ],
                      "text_source": "template",
                      "items_count": 14,
                      "suppliers_count": 3,
                      "open_po_count": 9,
                      "open_po_value": 73682,
                      "exposure": 18420.5,
                      "exposure_basis": "additional",
                      "created_at": "2026-11-20T05:14:02.000+00:00",
                      "refreshed_at": "2026-11-21T05:12:41.000+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/trade/tariff_impact/history": {
      "get": {
        "operationId": "listTariffImpactHistory",
        "summary": "Daily tariff impact totals",
        "description": "Key scope: read (or execute). Module: tariff. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Deprecated: use from",
            "deprecated": true
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day"
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Deprecated: use to",
            "deprecated": true
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TariffImpactDay"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date",
                          "description": "The `from` filter"
                        },
                        "to": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date",
                          "description": "The `to` filter"
                        }
                      },
                      "required": [
                        "from",
                        "to"
                      ],
                      "description": "The filters as applied"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "ffb43cfb-6625-407e-ae58-9e59edd67a5b",
                  "filters": {
                    "from": null,
                    "to": null
                  },
                  "data": [
                    {
                      "day": "2026-11-21",
                      "exposure": 31250.75,
                      "exposure_is_ceiling": false,
                      "open_po_value": 148300,
                      "open_po_value_total": 612900,
                      "items_count": 37,
                      "actions_in_force": 4,
                      "upcoming_exposure": 2100,
                      "computed_at": "2026-11-21T05:12:40.000+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/trade/tariff_impact/rollups": {
      "get": {
        "operationId": "listTariffImpactRollups",
        "summary": "Your tariff impact rolled up by summary, action, item or supplier",
        "description": "Key scope: read (or execute). Module: tariff. Answers the list object (object, data, has_more, next_cursor). The lists inside a row's `detail` are cut (an action's items at 25, a supplier's items at 12, an item's suppliers at 6); the counts on the row and in the summary row are the full counts.",
        "tags": [
          "trade"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "summary",
                "action",
                "item",
                "supplier"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "in_force",
                "upcoming"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "next_cursor of the previous page"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TariffImpactRollup"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "summary",
                            "action",
                            "item",
                            "supplier"
                          ]
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "in_force",
                            "upcoming",
                            null
                          ]
                        }
                      },
                      "required": [
                        "kind",
                        "status"
                      ],
                      "description": "The filters as applied"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "filters",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "67bd114b-dd15-4c46-9221-9f59cfd497e0",
                  "filters": {
                    "kind": "action",
                    "status": null
                  },
                  "data": [
                    {
                      "kind": "action",
                      "key": "d76a9df8-7925-4fcb-9376-a62d308a0634",
                      "status": "in_force",
                      "label": "Section 232: steel and aluminium derivatives",
                      "exposure": 18420.5,
                      "exposure_is_ceiling": false,
                      "open_po_value": 73682,
                      "open_po_count": 9,
                      "items_count": 14,
                      "rate_percent": 25,
                      "effective_date": "2026-03-12",
                      "detail": {
                        "action_id": "d76a9df8-7925-4fcb-9376-a62d308a0634",
                        "type": "Section 232",
                        "heading": "9903.81.90",
                        "rate_percent": 25,
                        "rate_basis": "additional",
                        "countries": [],
                        "applies_globally": true,
                        "effective_date": "2026-03-12",
                        "expiry_date": null,
                        "source": {
                          "tier": "schedule",
                          "description": "Derivative steel and aluminium articles",
                          "url": "https://hts.usitc.gov/search?query=9903.81.90"
                        },
                        "action_version": "2026-03-12:25",
                        "matched_prefixes": [
                          "7323",
                          "7615"
                        ],
                        "suppliers_count": 3,
                        "spend_12m": 412300,
                        "items_without_mfn": 0,
                        "items": [
                          {
                            "code": "MAT-00000118",
                            "description": "Cookware set, stainless steel",
                            "hs_code": "7323.93.0045",
                            "matched_prefix": "7323",
                            "mfn_rate_percent": 2,
                            "additional_rate_percent": 25,
                            "open_po_value": 21400,
                            "exposure": 5350,
                            "suppliers": [
                              {
                                "name": "Guangzhou Housewares Mfg 0131",
                                "country": "CN",
                                "open_pos": [
                                  "4500012345"
                                ]
                              }
                            ]
                          }
                        ],
                        "alternatives": [
                          {
                            "name": "Monterrey Housewares 0044",
                            "country": "MX",
                            "items": [
                              "MAT-00000118"
                            ],
                            "spend_12m": 38200
                          }
                        ],
                        "alternatives_count": 1
                      },
                      "computed_at": "2026-11-21T05:12:40.000+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": "tariff",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "getUsage",
        "summary": "Requests against each key's daily quota today, and requests and failures per key and day",
        "description": "Key scope: read (or execute). At most 500 keys are listed",
        "tags": [
          "usage"
        ],
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30,
              "default": 30
            },
            "description": "UTC calendar days, today included"
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "live",
                "test"
              ]
            },
            "description": "A key reads its own environment only: the other value returns nothing"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "days": {
                      "type": "integer"
                    },
                    "keys": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "key",
                              "oauth"
                            ]
                          },
                          "environment": {
                            "type": "string",
                            "enum": [
                              "live",
                              "test"
                            ],
                            "description": "test: a key of your sandbox (ic_test_...)"
                          },
                          "active": {
                            "type": "boolean"
                          },
                          "key_hint": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "daily_limit": {
                            "type": "integer",
                            "description": "Requests a day; 0 when the key has no limit of its own"
                          },
                          "requests_today": {
                            "type": "integer",
                            "description": "Requests counted today (UTC); 0 when the key has not been used today"
                          },
                          "remaining_today": {
                            "type": "integer"
                          },
                          "last_used_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "kind",
                          "environment",
                          "active",
                          "key_hint",
                          "daily_limit",
                          "requests_today",
                          "remaining_today",
                          "last_used_at"
                        ]
                      }
                    },
                    "daily": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "day": {
                            "type": "string",
                            "format": "date"
                          },
                          "api_key_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "environment": {
                            "type": "string",
                            "enum": [
                              "live",
                              "test"
                            ],
                            "description": "test: a key of your sandbox (ic_test_...)"
                          },
                          "requests": {
                            "type": "integer"
                          },
                          "client_errors": {
                            "type": "integer",
                            "description": "4xx answers other than 429"
                          },
                          "rate_limited": {
                            "type": "integer",
                            "description": "429 answers"
                          },
                          "server_errors": {
                            "type": "integer",
                            "description": "5xx answers"
                          },
                          "p50_ms": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "p95_ms": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "day",
                          "api_key_id",
                          "environment",
                          "requests",
                          "client_errors",
                          "rate_limited",
                          "server_errors",
                          "p50_ms",
                          "p95_ms"
                        ]
                      },
                      "description": "One row per key and day (UTC) that had calls, newest day first"
                    },
                    "retention_days": {
                      "type": "integer",
                      "description": "Days the log is kept"
                    },
                    "organization": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "is_sandbox": {
                          "type": "boolean",
                          "description": "The organization is a sandbox (the key is a test key)"
                        },
                        "is_demo": {
                          "type": "boolean",
                          "description": "The organization is marked as a demo organization"
                        }
                      },
                      "required": [
                        "id",
                        "is_sandbox",
                        "is_demo"
                      ],
                      "description": "Sent to an API key only: the key's own organization"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "as_of",
                    "days",
                    "keys",
                    "daily",
                    "retention_days",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "1dffca8f-dd7c-44c6-b72f-a936301413ed",
                  "as_of": "2026-11-21T16:04:19.974Z",
                  "days": 30,
                  "keys": [
                    {
                      "id": "8c1bb392-ffb1-40a6-a98e-7dcef4229aa8",
                      "name": "Warehouse sync (EU)",
                      "kind": "key",
                      "environment": "live",
                      "active": true,
                      "key_hint": "ic_live_...rb10",
                      "daily_limit": 500,
                      "requests_today": 0,
                      "remaining_today": 500,
                      "last_used_at": null
                    }
                  ],
                  "daily": [
                    {
                      "day": "2026-11-21",
                      "api_key_id": "028bb732-40d9-4b79-84bf-dc553e56d82e",
                      "environment": "live",
                      "requests": 3,
                      "client_errors": 0,
                      "rate_limited": 0,
                      "server_errors": 0,
                      "p50_ms": 18,
                      "p95_ms": 41
                    }
                  ],
                  "retention_days": 30
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "read",
        "x-module": null,
        "x-writes": false
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "summary": "Your webhook endpoints (never the secret)",
        "description": "Key scope: approve. Module: alerts. The key's creator must be an organization admin now. Answers the list object (object, data, has_more, next_cursor); the same rows stay under `webhooks`, deprecated.",
        "tags": [
          "webhooks"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      },
                      "deprecated": true,
                      "description": "Deprecated: the same rows as `data`"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "recommendation",
                          "connector",
                          "disruption",
                          "tariff_brief",
                          "writeback",
                          "system_change",
                          "recall",
                          "party_screening"
                        ]
                      },
                      "description": "Every event an endpoint can subscribe to"
                    },
                    "max_webhooks": {
                      "type": "integer",
                      "description": "Endpoints an organization can have"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "webhooks",
                    "events",
                    "max_webhooks",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "af999f94-1f6d-40d7-b3d2-3d83cad4ce13",
                  "webhooks": [
                    {
                      "id": "0664b067-7a61-48f2-862b-933decd489a5",
                      "url": "https://hooks.example.com/live",
                      "events": [
                        "recommendation",
                        "disruption"
                      ],
                      "active": true,
                      "last_delivery_at": "2026-11-21T15:55:15.062+00:00",
                      "last_delivery_status": "200",
                      "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                      "created_at": "2026-11-21T15:47:23.988701+00:00",
                      "updated_at": "2026-11-21T15:55:42.866541+00:00",
                      "secret_rotated_at": "2026-11-21T15:55:42.865+00:00",
                      "previous_secret_expires_at": null
                    }
                  ],
                  "events": [
                    "recommendation",
                    "connector",
                    "disruption",
                    "tariff_brief",
                    "writeback",
                    "system_change",
                    "recall"
                  ],
                  "max_webhooks": 10,
                  "object": "list",
                  "data": [
                    {
                      "id": "0664b067-7a61-48f2-862b-933decd489a5",
                      "url": "https://hooks.example.com/live",
                      "events": [
                        "recommendation",
                        "disruption"
                      ],
                      "active": true,
                      "last_delivery_at": "2026-11-21T15:55:15.062+00:00",
                      "last_delivery_status": "200",
                      "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                      "created_at": "2026-11-21T15:47:23.988701+00:00",
                      "updated_at": "2026-11-21T15:55:42.866541+00:00",
                      "secret_rotated_at": "2026-11-21T15:55:42.865+00:00",
                      "previous_secret_expires_at": null
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "approve",
        "x-module": "alerts",
        "x-writes": false,
        "x-list": {
          "paging": "none",
          "deprecated_field": "webhooks"
        }
      },
      "post": {
        "operationId": "createWebhook",
        "summary": "Add an endpoint; the signing secret is in this response only. At most 10 endpoints per organization (409 above). 30 endpoint changes an hour per organization (429 above)",
        "description": "Key scope: approve. Module: alerts. The key's creator must be an organization admin now.",
        "tags": [
          "webhooks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2048,
                    "description": "Public https URL with no credentials in it, at most 2048 characters; its host must resolve to a public address"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "recommendation",
                        "connector",
                        "disruption",
                        "tariff_brief",
                        "writeback",
                        "system_change",
                        "recall",
                        "party_screening"
                      ]
                    },
                    "minItems": 1,
                    "description": "Default: every event"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              },
              "example": {
                "url": "https://example.com/webhooks/insightchain",
                "events": [
                  "recommendation",
                  "disruption"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    "secret": {
                      "type": "string",
                      "description": "The signing secret. Shown in this response only; store it now"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "webhook",
                    "secret",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "4fced04a-1c82-4f83-b1f3-aed4f2e515de",
                  "webhook": {
                    "id": "9a561de2-c35a-46ed-896b-ec30572b8b83",
                    "url": "https://example.com/insightchain-webhook",
                    "events": [
                      "recommendation"
                    ],
                    "active": true,
                    "last_delivery_at": null,
                    "last_delivery_status": null,
                    "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "created_at": "2026-11-21T16:04:19.590469+00:00",
                    "updated_at": "2026-11-21T16:04:19.590469+00:00",
                    "secret_rotated_at": null,
                    "previous_secret_expires_at": null
                  },
                  "secret": "shown-once-example-value"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "approve",
        "x-module": "alerts",
        "x-writes": true
      }
    },
    "/v1/webhooks/{id}": {
      "patch": {
        "operationId": "updateWebhook",
        "summary": "Change an endpoint's URL, events or active flag. At least one of url, events or active is required. 30 endpoint changes an hour per organization (429 above)",
        "description": "Key scope: approve. Module: alerts. The key's creator must be an organization admin now.",
        "tags": [
          "webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2048,
                    "description": "Public https URL with no credentials in it, at most 2048 characters; its host must resolve to a public address"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "recommendation",
                        "connector",
                        "disruption",
                        "tariff_brief",
                        "writeback",
                        "system_change",
                        "recall",
                        "party_screening"
                      ]
                    },
                    "minItems": 1
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              },
              "example": {
                "active": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "webhook",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "57f4b72a-1c57-4dfa-9515-c726eb9fd97d",
                  "webhook": {
                    "id": "9a561de2-c35a-46ed-896b-ec30572b8b83",
                    "url": "https://example.com/insightchain-webhook",
                    "events": [
                      "recommendation"
                    ],
                    "active": false,
                    "last_delivery_at": null,
                    "last_delivery_status": null,
                    "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "created_at": "2026-11-21T16:04:19.590469+00:00",
                    "updated_at": "2026-11-21T16:04:19.607766+00:00",
                    "secret_rotated_at": null,
                    "previous_secret_expires_at": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "approve",
        "x-module": "alerts",
        "x-writes": true
      },
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Remove an endpoint. 30 endpoint changes an hour per organization (429 above)",
        "description": "Key scope: approve. Module: alerts. The key's creator must be an organization admin now.",
        "tags": [
          "webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "const": true
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "deleted",
                    "id",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "fc1dd48d-09ad-444c-8e50-dfe29c265543",
                  "deleted": true,
                  "id": "9a561de2-c35a-46ed-896b-ec30572b8b83"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "approve",
        "x-module": "alerts",
        "x-writes": true
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "summary": "The delivery log of an endpoint: every attempt of the last 30 days, newest first",
        "description": "Key scope: approve. Module: alerts. The key's creator must be an organization admin now. Answers the list object (object, data, has_more, next_cursor).",
        "tags": [
          "webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "delivery_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Only the attempts of this delivery"
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "delivered",
                "retry",
                "failed"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookDeliveryAttempt"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether a further page exists"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Send as `cursor` for the next page; null on the last page"
                    },
                    "retention_days": {
                      "type": "integer",
                      "description": "Days the log is kept"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor",
                    "retention_days",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "9a4fcfa8-60c9-4546-97e1-f3cd37c83ae5",
                  "data": [
                    {
                      "id": "0dcb39d8-7bc6-4034-ad22-559186d7b347",
                      "delivery_id": "8d1b21b0-1ec9-4909-84b2-48bbd810c918",
                      "alert_id": null,
                      "event_type": "insightchain.test",
                      "attempt": 1,
                      "trigger": "test",
                      "outcome": "failed",
                      "status": "405",
                      "duration_ms": 46,
                      "next_attempt_at": null,
                      "attempted_at": "2026-11-21T16:04:19.684724+00:00"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null,
                  "retention_days": 30,
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "approve",
        "x-module": "alerts",
        "x-writes": false,
        "x-list": {
          "paging": "cursor"
        }
      }
    },
    "/v1/webhooks/{id}/deliveries/{delivery_id}/redeliver": {
      "post": {
        "operationId": "redeliverWebhookDelivery",
        "summary": "Send a finished delivery once more, now. One attempt; the answer says how it went. A delivery still being retried, a cancelled one, or one of a switched-off endpoint is 409; a test event cannot be redelivered. 30 an hour per organization (429 above)",
        "description": "Key scope: approve. Module: alerts. The key's creator must be an organization admin now.",
        "tags": [
          "webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "delivery_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "delivery": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "alert_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "delivered",
                            "failed"
                          ],
                          "description": "How the delivery stands after this attempt"
                        },
                        "attempts": {
                          "type": "integer"
                        },
                        "last_status": {
                          "type": "string",
                          "description": "The HTTP status your endpoint answered (as text), or one of timeout, unreachable, redirect_refused, blocked_url"
                        }
                      },
                      "required": [
                        "id",
                        "alert_id",
                        "status",
                        "attempts",
                        "last_status"
                      ]
                    },
                    "attempt": {
                      "type": "object",
                      "properties": {
                        "attempt": {
                          "type": "integer"
                        },
                        "delivered": {
                          "type": "boolean"
                        },
                        "outcome": {
                          "type": "string",
                          "enum": [
                            "delivered",
                            "failed"
                          ]
                        },
                        "status": {
                          "type": "string"
                        },
                        "duration_ms": {
                          "type": "integer"
                        },
                        "reason": {
                          "type": "string",
                          "description": "Why the URL was not called (blocked only)"
                        }
                      },
                      "required": [
                        "attempt",
                        "delivered",
                        "outcome",
                        "status",
                        "duration_ms"
                      ],
                      "description": "A summary of the attempt just made; GET /v1/webhooks/{id}/deliveries lists it in full"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "delivery",
                    "attempt",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "c34266d6-15ea-405d-bd0b-60f4777fdee9",
                  "delivery": {
                    "id": "25c683c7-ffee-44a3-a80e-b45cb8232b4b",
                    "alert_id": "790ec098-8100-4197-b1d1-1cb873616bfc",
                    "status": "delivered",
                    "attempts": 3,
                    "last_status": "200"
                  },
                  "attempt": {
                    "attempt": 3,
                    "delivered": true,
                    "outcome": "delivered",
                    "status": "200",
                    "duration_ms": 7
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "approve",
        "x-module": "alerts",
        "x-writes": true
      }
    },
    "/v1/webhooks/{id}/rotate_secret": {
      "post": {
        "operationId": "rotateWebhookSecret",
        "summary": "A new signing secret, in this response only. With overlap_seconds the old secret keeps signing beside the new one until the window ends. 30 endpoint changes an hour per organization (429 above)",
        "description": "Key scope: approve. Module: alerts. The key's creator must be an organization admin now.",
        "tags": [
          "webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "overlap_seconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 604800,
                    "default": 0,
                    "description": "How long the old secret keeps signing beside the new one. 0, the default: it stops now"
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "overlap_seconds": 3600
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    "secret": {
                      "type": "string",
                      "description": "The signing secret. Shown in this response only; store it now"
                    },
                    "previous_secret_expires_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "Until when deliveries are also signed with the previous secret; null: it stopped now"
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "webhook",
                    "secret",
                    "previous_secret_expires_at",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "1edb8d98-ebf5-4a96-a656-527295500433",
                  "webhook": {
                    "id": "9a561de2-c35a-46ed-896b-ec30572b8b83",
                    "url": "https://example.com/insightchain-webhook",
                    "events": [
                      "recommendation"
                    ],
                    "active": false,
                    "last_delivery_at": null,
                    "last_delivery_status": null,
                    "created_by": "352c0d6b-a387-436c-9dcb-6ae0fe61237c",
                    "created_at": "2026-11-21T16:04:19.590469+00:00",
                    "updated_at": "2026-11-21T16:04:19.623646+00:00",
                    "secret_rotated_at": "2026-11-21T16:04:19.623+00:00",
                    "previous_secret_expires_at": null
                  },
                  "secret": "shown-once-example-value",
                  "previous_secret_expires_at": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "approve",
        "x-module": "alerts",
        "x-writes": true
      }
    },
    "/v1/webhooks/{id}/test": {
      "post": {
        "operationId": "testWebhook",
        "summary": "Send one signed insightchain.test event now (10 an hour per organization, 429 above)",
        "description": "Key scope: approve. Module: alerts. The key's creator must be an organization admin now.",
        "tags": [
          "webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7E]{1,128}$"
            },
            "description": "Makes a retry safe for 24 hours: the same key and body replays the first answer (Idempotency-Replayed: true), another body is 422 idempotency_key_reused, a request still running is 409 idempotency_key_in_use"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-RateLimit-Limit-Day": {
                "$ref": "#/components/headers/X-RateLimit-Limit-Day"
              },
              "X-RateLimit-Remaining-Day": {
                "$ref": "#/components/headers/X-RateLimit-Remaining-Day"
              },
              "X-Request-ID": {
                "$ref": "#/components/headers/X-Request-ID"
              },
              "X-Client-Request-ID": {
                "$ref": "#/components/headers/X-Client-Request-ID"
              },
              "X-InsightChain-Sandbox": {
                "$ref": "#/components/headers/X-InsightChain-Sandbox"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/Idempotency-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "test": {
                      "type": "object",
                      "properties": {
                        "event_id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "The id of the test event: the X-InsightChain-Delivery header your endpoint received, and delivery_id in the delivery log"
                        },
                        "delivered": {
                          "type": "boolean"
                        },
                        "outcome": {
                          "type": "string",
                          "enum": [
                            "delivered",
                            "failed",
                            "failed_retryable"
                          ],
                          "description": "failed_retryable: a real delivery would be tried again; a test is sent once"
                        },
                        "last_status": {
                          "type": "string",
                          "description": "The HTTP status your endpoint answered (as text), or one of timeout, unreachable, redirect_refused, blocked_url"
                        },
                        "reason": {
                          "type": "string",
                          "description": "Why the URL was not called (blocked only)"
                        }
                      },
                      "required": [
                        "event_id",
                        "delivered",
                        "outcome",
                        "last_status"
                      ]
                    },
                    "request_id": {
                      "type": "string",
                      "description": "Quote this when asking about the request; also the X-Request-ID header"
                    }
                  },
                  "required": [
                    "test",
                    "request_id"
                  ]
                },
                "example": {
                  "request_id": "09de97c9-b623-4c5e-ab80-10c007901c44",
                  "test": {
                    "event_id": "8d1b21b0-1ec9-4909-84b2-48bbd810c918",
                    "delivered": false,
                    "outcome": "failed",
                    "last_status": "405"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "approve",
        "x-module": "alerts",
        "x-writes": true
      }
    }
  }
}
